libpkgconf: PKG_BUFSIZE becomes PKGCONF_BUFSIZE, remove unused PKG_MIN/PKG_MAX.

feature/tap-sh
William Pitcock 2015-09-06 11:29:56 -05:00
parent ca1b02659a
commit 571d9c756c
6 changed files with 15 additions and 18 deletions

View File

@ -87,8 +87,8 @@ pkgconf_dependency_parse_str(pkgconf_list_t *deplist_head, const char *depends)
{
parse_state_t state = OUTSIDE_MODULE;
pkgconf_pkg_comparator_t compare = PKG_ANY;
char cmpname[PKG_BUFSIZE];
char buf[PKG_BUFSIZE];
char cmpname[PKGCONF_BUFSIZE];
char buf[PKGCONF_BUFSIZE];
size_t package_sz = 0, version_sz = 0;
char *start = buf;
char *ptr = buf;

View File

@ -18,7 +18,7 @@
static inline char *
pkgconf_fragment_copy_munged(const char *source, unsigned int flags)
{
char mungebuf[PKG_BUFSIZE];
char mungebuf[PKGCONF_BUFSIZE];
char *sysroot_dir;
if (!(flags & PKGF_MUNGE_SYSROOT_PREFIX))

View File

@ -21,7 +21,7 @@
#include <libpkgconf/iter.h>
#include <libpkgconf/bsdstubs.h>
#define PKG_BUFSIZE (65535)
#define PKGCONF_BUFSIZE (65535)
typedef enum {
PKG_ANY = 0,
@ -49,9 +49,6 @@ typedef struct pkgconf_fragment_ pkgconf_fragment_t;
#define PKGCONF_FOREACH_LIST_ENTRY_REVERSE(tail, value) \
for ((value) = (tail); (value) != NULL; (value) = (value)->prev)
#define PKG_MIN(a,b) (((a) < (b)) ? (a) : (b))
#define PKG_MAX(a,b) (((a) > (b)) ? (a) : (b))
struct pkgconf_fragment_ {
pkgconf_node_t iter;

View File

@ -130,7 +130,7 @@ get_pkgconfig_path(void)
static const char *
pkg_get_parent_dir(pkgconf_pkg_t *pkg)
{
static char buf[PKG_BUFSIZE];
static char buf[PKGCONF_BUFSIZE];
char *pathbuf;
strlcpy(buf, pkg->filename, sizeof buf);
@ -174,7 +174,7 @@ pkgconf_pkg_t *
pkgconf_pkg_new_from_file(const char *filename, FILE *f, unsigned int flags)
{
pkgconf_pkg_t *pkg;
char readbuf[PKG_BUFSIZE];
char readbuf[PKGCONF_BUFSIZE];
char *idptr;
pkg = calloc(sizeof(pkgconf_pkg_t), 1);
@ -192,7 +192,7 @@ pkgconf_pkg_new_from_file(const char *filename, FILE *f, unsigned int flags)
if (idptr)
*idptr = '\0';
while (pkgconf_fgetline(readbuf, PKG_BUFSIZE, f) != NULL)
while (pkgconf_fgetline(readbuf, PKGCONF_BUFSIZE, f) != NULL)
{
char op, *p, *key, *value;
@ -347,7 +347,7 @@ pkgconf_pkg_scan_dir(const char *path, pkgconf_pkg_iteration_func_t func)
for (dirent = readdir(dir); dirent != NULL; dirent = readdir(dir))
{
static char filebuf[PKG_BUFSIZE];
static char filebuf[PKGCONF_BUFSIZE];
pkgconf_pkg_t *pkg;
FILE *f;
struct stat st;
@ -492,7 +492,7 @@ int
pkgconf_compare_version(const char *a, const char *b)
{
char oldch1, oldch2;
char buf1[PKG_BUFSIZE], buf2[PKG_BUFSIZE];
char buf1[PKGCONF_BUFSIZE], buf2[PKGCONF_BUFSIZE];
char *str1, *str2;
char *one, *two;
int ret;

View File

@ -97,17 +97,17 @@ pkgconf_tuple_find(pkgconf_list_t *list, const char *key)
char *
pkgconf_tuple_parse(pkgconf_list_t *vars, const char *value)
{
char buf[PKG_BUFSIZE];
char buf[PKGCONF_BUFSIZE];
const char *ptr;
char *bptr = buf;
for (ptr = value; *ptr != '\0' && bptr - buf < PKG_BUFSIZE; ptr++)
for (ptr = value; *ptr != '\0' && bptr - buf < PKGCONF_BUFSIZE; ptr++)
{
if (*ptr != '$' || (*ptr == '$' && *(ptr + 1) != '{'))
*bptr++ = *ptr;
else if (*(ptr + 1) == '{')
{
static char varname[PKG_BUFSIZE];
static char varname[PKGCONF_BUFSIZE];
char *vptr = varname;
const char *pptr;
char *kv, *parsekv;
@ -132,7 +132,7 @@ pkgconf_tuple_parse(pkgconf_list_t *vars, const char *value)
{
parsekv = pkgconf_tuple_parse(vars, kv);
strncpy(bptr, parsekv, PKG_BUFSIZE - (bptr - buf));
strncpy(bptr, parsekv, PKGCONF_BUFSIZE - (bptr - buf));
bptr += strlen(parsekv);
free(parsekv);

4
main.c
View File

@ -294,7 +294,7 @@ apply_variables(pkgconf_pkg_t *world, void *unused, int maxdepth, unsigned int f
typedef struct {
const char *variable;
char buf[PKG_BUFSIZE];
char buf[PKGCONF_BUFSIZE];
} var_request_t;
static void
@ -855,7 +855,7 @@ main(int argc, char *argv[])
}
else
{
char packagebuf[PKG_BUFSIZE];
char packagebuf[PKGCONF_BUFSIZE];
snprintf(packagebuf, sizeof packagebuf, "%s %s %s", package, argv[pkg_optind + 1], argv[pkg_optind + 2]);
pkg_optind += 3;