ack/util/ack/grows.h
George Koehler 65278bc9a9 In util/ack, add prototypes and static to functions.
Declare most functions before using them.  I declare some functions in
ack.h and some in trans.h (because trans.h declares type trf).  I
leave declarations of scanb() and scanvars() in .c files because they
need type growstring.  (I can't #include "grows.h" in another header
file as long as grows.h doesn't guard against multiple inclusion.)

Functions used within one file become static.  I remove a few tiny
functions.  I move a few functions or declarations to more convenient
places.  Some functions now return void instead of a garbage int.

I feel that keyword "register" is obsolete, so I removed it from where
I was editing.  This commit doesn't touch mktables.c
2016-11-12 21:12:45 -05:00

28 lines
1,014 B
C

/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
#ifndef NORCSID
#define RCS_GROWS "$Id$"
#endif
/* struct used to identify and do bookkeeping for growing strings */
typedef struct {
char *gr_string ; /* Points to start of string */
unsigned gr_size ; /* Current string size */
unsigned gr_max ; /* Maximum string size */
} growstring ;
#define GR_MORE 50 /* Steps to grow */
#define gr_start(id) (id).gr_string /* The start of the string */
/* Routines used */
void gr_throw(growstring *) ; /* To free the core */
int gr_add(growstring *, int) ; /* To add one character */
int gr_cat(growstring *, const char *) ; /* To append a string */
void gr_init(growstring *) ; /* Initialize the bookkeeping */
char *gr_final(growstring *) ; /* Move to a stable storage string */