/* Structure for dynamically resizable strings. */
-typedef struct
+struct String
{
unsigned alloc; /* Size of allocation for the text. */
unsigned length; /* Length of the text currently. */
char *text; /* Pointer to the text. */
-} *string, stringstruct;
+};
+typedef struct String String;
int stat ();
int lstat ();
static void hash_init __P ((unsigned int modulus,
unsigned int entry_tab_size));
static void hash_reset __P ((void));
-static void str_concatc __P ((string s1, char *cstr));
-static void str_copyc __P ((string s1, char *cstr));
-static void str_init __P ((string *s1, unsigned int size));
-static void str_trunc __P ((string s1, unsigned int length));
+static void str_concatc __P ((String *s1, char *cstr));
+static void str_copyc __P ((String *s1, char *cstr));
+static void str_init __P ((String **s1, unsigned int size));
+static void str_trunc __P ((String *s1, unsigned int length));
/* Name under which this program was invoked. */
char *program_name;
static int output_units;
/* Accumulated path for file or directory being processed. */
-static string path;
+static String *path;
/* Pointer to hash structure, used by the hash routines. */
static struct htab *htab;
return 0;
}
-/* Initialize the struct string S1 for holding SIZE characters. */
+/* Initialize string S1 to hold SIZE characters. */
static void
-str_init (string *s1, unsigned int size)
+str_init (String **s1, unsigned int size)
{
- string s;
+ String *s;
- s = (string) xmalloc (sizeof (stringstruct));
+ s = (String *) xmalloc (sizeof (struct String));
s->text = xmalloc (size + 1);
s->alloc = size;
}
static void
-ensure_space (string s, unsigned int size)
+ensure_space (String * s, unsigned int size)
{
if (s->alloc < size)
{
/* Assign the null-terminated C-string CSTR to S1. */
static void
-str_copyc (string s1, char *cstr)
+str_copyc (String *s1, char *cstr)
{
unsigned l = strlen (cstr);
ensure_space (s1, l);
}
static void
-str_concatc (string s1, char *cstr)
+str_concatc (String *s1, char *cstr)
{
unsigned l1 = s1->length;
unsigned l2 = strlen (cstr);
/* Truncate the string S1 to have length LENGTH. */
static void
-str_trunc (string s1, unsigned int length)
+str_trunc (String *s1, unsigned int length)
{
if (s1->length > length)
{