libpkgconf: migrate to using the pkgconf_ namespaced strlcat/strlcpy symbols

feature/tap-sh
William Pitcock 2016-12-10 16:19:40 -06:00
parent bdaa26231b
commit 8213d91038
4 changed files with 24 additions and 24 deletions

View File

@ -41,10 +41,10 @@ pkgconf_dependency_addraw(pkgconf_list_t *list, const char *package, size_t pack
pkgconf_dependency_t *dep;
dep = calloc(sizeof(pkgconf_dependency_t), 1);
dep->package = strndup(package, package_sz);
dep->package = pkgconf_strndup(package, package_sz);
if (version_sz != 0)
dep->version = strndup(version, version_sz);
dep->version = pkgconf_strndup(version, version_sz);
dep->compare = compare;
@ -103,8 +103,8 @@ pkgconf_dependency_parse_str(pkgconf_list_t *deplist_head, const char *depends)
memset(cmpname, '\0', sizeof cmpname);
strlcpy(buf, depends, sizeof buf);
strlcat(buf, " ", sizeof buf);
pkgconf_strlcpy(buf, depends, sizeof buf);
pkgconf_strlcat(buf, " ", sizeof buf);
while (*ptr)
{

View File

@ -79,9 +79,9 @@ pkgconf_fragment_munge(const pkgconf_client_t *client, char *buf, size_t buflen,
sysroot_dir = pkgconf_tuple_find_global(client, "pc_sysrootdir");
if (pkgconf_fragment_should_munge(source, sysroot_dir))
strlcat(buf, sysroot_dir, buflen);
pkgconf_strlcat(buf, sysroot_dir, buflen);
strlcat(buf, source, buflen);
pkgconf_strlcat(buf, source, buflen);
}
static inline char *
@ -130,9 +130,9 @@ pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const
len = strlen(parent->data) + strlen(mungebuf) + 2;
newdata = malloc(len);
strlcpy(newdata, parent->data, len);
strlcat(newdata, " ", len);
strlcat(newdata, mungebuf, len);
pkgconf_strlcpy(newdata, parent->data, len);
pkgconf_strlcat(newdata, " ", len);
pkgconf_strlcat(newdata, mungebuf, len);
free(parent->data);
parent->data = newdata;
@ -286,7 +286,7 @@ pkgconf_fragment_render_buf(const pkgconf_list_t *list, char *buf, size_t buflen
}
if (frag->data)
bptr += strlcpy(bptr, frag->data, buflen - (bptr - buf));
bptr += pkgconf_strlcpy(bptr, frag->data, buflen - (bptr - buf));
*bptr++ = ' ';
}

View File

@ -77,13 +77,13 @@ get_default_pkgconfig_path(void)
return PKG_DEFAULT_PATH;
*p = '\0';
strlcpy(outbuf, namebuf, sizeof outbuf);
strlcat(outbuf, "/", sizeof outbuf);
strlcat(outbuf, "../lib/pkgconfig", sizeof outbuf);
strlcat(outbuf, ";", sizeof outbuf);
strlcat(outbuf, namebuf, sizeof outbuf);
strlcat(outbuf, "/", sizeof outbuf);
strlcat(outbuf, "../share/pkgconfig", sizeof outbuf);
pkgconf_strlcpy(outbuf, namebuf, sizeof outbuf);
pkgconf_strlcat(outbuf, "/", sizeof outbuf);
pkgconf_strlcat(outbuf, "../lib/pkgconfig", sizeof outbuf);
pkgconf_strlcat(outbuf, ";", sizeof outbuf);
pkgconf_strlcat(outbuf, namebuf, sizeof outbuf);
pkgconf_strlcat(outbuf, "/", sizeof outbuf);
pkgconf_strlcat(outbuf, "../share/pkgconfig", sizeof outbuf);
return outbuf;
#endif
@ -97,7 +97,7 @@ pkg_get_parent_dir(pkgconf_pkg_t *pkg)
static char buf[PKGCONF_BUFSIZE];
char *pathbuf;
strlcpy(buf, pkg->filename, sizeof buf);
pkgconf_strlcpy(buf, pkg->filename, sizeof buf);
pathbuf = strrchr(buf, PKG_DIR_SEP_S);
if (pathbuf == NULL)
pathbuf = strrchr(buf, '/');
@ -357,9 +357,9 @@ pkgconf_pkg_scan_dir(pkgconf_client_t *client, const char *path, void *data, pkg
FILE *f;
struct stat st;
strlcpy(filebuf, path, sizeof filebuf);
strlcat(filebuf, "/", sizeof filebuf);
strlcat(filebuf, dirent->d_name, sizeof filebuf);
pkgconf_strlcpy(filebuf, path, sizeof filebuf);
pkgconf_strlcat(filebuf, "/", sizeof filebuf);
pkgconf_strlcat(filebuf, dirent->d_name, sizeof filebuf);
stat(filebuf, &st);
if (!(S_ISREG(st.st_mode)))
@ -524,8 +524,8 @@ pkgconf_compare_version(const char *a, const char *b)
if (!strcasecmp(a, b))
return 0;
strlcpy(buf1, a, sizeof buf1);
strlcpy(buf2, b, sizeof buf2);
pkgconf_strlcpy(buf1, a, sizeof buf1);
pkgconf_strlcpy(buf2, b, sizeof buf2);
one = str1 = buf1;
two = str2 = buf2;

View File

@ -122,7 +122,7 @@ pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const
char *bptr = buf;
if (*value == '/' && client->sysroot_dir != NULL && strncmp(value, client->sysroot_dir, strlen(client->sysroot_dir)))
bptr += strlcpy(buf, client->sysroot_dir, sizeof buf);
bptr += pkgconf_strlcpy(buf, client->sysroot_dir, sizeof buf);
for (ptr = value; *ptr != '\0' && bptr - buf < PKGCONF_BUFSIZE; ptr++)
{