X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fanno.c;h=33d2b49dec03d53c781946c15098b9f92a219862;hp=1c97179160c388f3ed3a129c67151edbed76d88d;hb=6e9577f324bef90765a5edc02044eb111ec48072;hpb=cf1205b5cbea2f0cd6ea710ec16c637df85b647c diff --git a/uip/anno.c b/uip/anno.c index 1c97179..33d2b49 100644 --- a/uip/anno.c +++ b/uip/anno.c @@ -53,6 +53,8 @@ static struct swit switches[] = { { NULL, 0 } }; +char *version=VERSION; + /* ** static prototypes */ @@ -181,7 +183,7 @@ main(int argc, char **argv) if (folder) adios(EX_USAGE, NULL, "only one folder at a time!"); else - folder = getcpy(expandfol(cp)); + folder = mh_xstrdup(expandfol(cp)); } else if (*cp == '/' || *cp == '.') { if (file) adios(EX_USAGE, NULL, "only one file at a time!"); @@ -305,7 +307,7 @@ annolist(char *file, unsigned char *comp, int number) } /* We'll grow this buffer as needed. */ - field = (char *)mh_xmalloc(field_size = 256); + field = mh_xcalloc(field_size = 256, sizeof(char)); make_comp(&comp); length = strlen(comp); /* Convenience copy. */ @@ -325,8 +327,7 @@ annolist(char *file, unsigned char *comp, int number) break; } if (++n >= field_size - 1) { - field = (char *)mh_xrealloc(field, - field_size += 256); + field = mh_xrealloc(field, field_size += 256); cp = field + n - 1; } } @@ -343,7 +344,7 @@ annolist(char *file, unsigned char *comp, int number) } while (*field && *field != '-'); - free(field); + mh_free0(&field); fclose(fp); return; @@ -459,7 +460,7 @@ dodel(int fd, unsigned char *comp, char *text, FILE *tmp, int number) if ((fp = fdopen(fd, "r")) == NULL) { adios(EX_IOERR, NULL, "unable to fdopen file."); } - field = (char *)mh_xmalloc(field_size); + field = mh_xcalloc(field_size, sizeof(char)); /* ** Copy lines from the input file to the temporary file @@ -487,8 +488,7 @@ dodel(int fd, unsigned char *comp, char *text, FILE *tmp, int number) } if (++n >= field_size - 1) { - field = (char *) mh_xrealloc(field, - field_size *= 2); + field = mh_xrealloc(field, field_size *= 2); cp = field + n - 1; } } @@ -544,7 +544,7 @@ dodel(int fd, unsigned char *comp, char *text, FILE *tmp, int number) } while (*field && *field != '-'); - free(field); + mh_free0(&field); fflush(tmp); fflush(fp); /* The underlying fd will be closed by lkclose() */