From b0cdca488eb8c0136e3a1a89219c33b267cab19a Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 21 Jul 2012 14:38:13 -0500 Subject: [PATCH] everything: do not shadow POSIX BUFSIZ definition --- dependency.c | 2 +- main.c | 2 +- pkg.c | 6 +++--- pkg.h | 4 +--- tuple.c | 8 ++++---- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/dependency.c b/dependency.c index c702d6c..ff20821 100644 --- a/dependency.c +++ b/dependency.c @@ -104,7 +104,7 @@ pkg_dependency_parse_str(pkg_dependency_t *deplist_head, const char *depends) parse_state_t state = OUTSIDE_MODULE; pkg_dependency_t *deplist = NULL; pkg_comparator_t compare = PKG_ANY; - char buf[BUFSIZ]; + char buf[PKG_BUFSIZE]; char *start = buf; char *ptr = buf; char *vstart = NULL; diff --git a/main.c b/main.c index 9b0da3e..a17731e 100644 --- a/main.c +++ b/main.c @@ -700,7 +700,7 @@ main(int argc, char *argv[]) } else { - char packagebuf[BUFSIZ]; + char packagebuf[PKG_BUFSIZE]; snprintf(packagebuf, sizeof packagebuf, "%s %s %s", package, argv[pkg_optind + 1], argv[pkg_optind + 2]); pkg_optind += 3; diff --git a/pkg.c b/pkg.c index 133c9e9..042b06e 100644 --- a/pkg.c +++ b/pkg.c @@ -127,12 +127,12 @@ pkg_t * pkg_new_from_file(const char *filename, FILE *f) { pkg_t *pkg; - char readbuf[BUFSIZ]; + char readbuf[PKG_BUFSIZE]; pkg = calloc(sizeof(pkg_t), 1); pkg->filename = strdup(filename); - while (pkg_fgetline(readbuf, BUFSIZ, f) != NULL) + while (pkg_fgetline(readbuf, PKG_BUFSIZE, f) != NULL) { char op, *p, *key = NULL, *value = NULL; @@ -366,7 +366,7 @@ int pkg_compare_version(const char *a, const char *b) { char oldch1, oldch2; - char buf1[BUFSIZ], buf2[BUFSIZ]; + char buf1[PKG_BUFSIZE], buf2[PKG_BUFSIZE]; char *str1, *str2; char *one, *two; int ret; diff --git a/pkg.h b/pkg.h index 6566519..28d5998 100644 --- a/pkg.h +++ b/pkg.h @@ -19,9 +19,7 @@ #include "config.h" #include "stdinc.h" -#ifndef BUFSIZ -#define BUFSIZ 65535 -#endif +#define PKG_BUFSIZE (65535) /* we are compatible with 0.27 of pkg-config */ #define PKG_PKGCONFIG_VERSION_EQUIV "0.27" diff --git a/tuple.c b/tuple.c index 669ffb5..769ea95 100644 --- a/tuple.c +++ b/tuple.c @@ -96,17 +96,17 @@ pkg_tuple_find(pkg_tuple_t *head, const char *key) char * pkg_tuple_parse(pkg_tuple_t *vars, const char *value) { - char buf[BUFSIZ]; + char buf[PKG_BUFSIZE]; const char *ptr; char *bptr = buf; - for (ptr = value; *ptr != '\0' && bptr - buf < BUFSIZ; ptr++) + for (ptr = value; *ptr != '\0' && bptr - buf < PKG_BUFSIZE; ptr++) { if (*ptr != '$') *bptr++ = *ptr; else if (*(ptr + 1) == '{') { - static char varname[BUFSIZ]; + static char varname[PKG_BUFSIZE]; char *vptr = varname; const char *pptr; char *kv, *parsekv; @@ -131,7 +131,7 @@ pkg_tuple_parse(pkg_tuple_t *vars, const char *value) { parsekv = pkg_tuple_parse(vars, kv); - strncpy(bptr, parsekv, BUFSIZ - (bptr - buf)); + strncpy(bptr, parsekv, PKG_BUFSIZE - (bptr - buf)); bptr += strlen(parsekv); free(parsekv);