everything: do not shadow POSIX BUFSIZ definition

feature/tap-sh
William Pitcock 2012-07-21 14:38:13 -05:00
parent f4d84620a1
commit b0cdca488e
5 changed files with 10 additions and 12 deletions

View File

@ -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;

2
main.c
View File

@ -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;

6
pkg.c
View File

@ -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;

4
pkg.h
View File

@ -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"

View File

@ -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);