From 8213d91038280575c262b441efc2d393ae5dd5a4 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 10 Dec 2016 16:19:40 -0600 Subject: [PATCH] libpkgconf: migrate to using the pkgconf_ namespaced strlcat/strlcpy symbols --- libpkgconf/dependency.c | 8 ++++---- libpkgconf/fragment.c | 12 ++++++------ libpkgconf/pkg.c | 26 +++++++++++++------------- libpkgconf/tuple.c | 2 +- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/libpkgconf/dependency.c b/libpkgconf/dependency.c index 160caa5..b8a80b2 100644 --- a/libpkgconf/dependency.c +++ b/libpkgconf/dependency.c @@ -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) { diff --git a/libpkgconf/fragment.c b/libpkgconf/fragment.c index 43cfaf5..baf3be0 100644 --- a/libpkgconf/fragment.c +++ b/libpkgconf/fragment.c @@ -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++ = ' '; } diff --git a/libpkgconf/pkg.c b/libpkgconf/pkg.c index 547b4df..1c8e766 100644 --- a/libpkgconf/pkg.c +++ b/libpkgconf/pkg.c @@ -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; diff --git a/libpkgconf/tuple.c b/libpkgconf/tuple.c index d4d3704..03803fc 100644 --- a/libpkgconf/tuple.c +++ b/libpkgconf/tuple.c @@ -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++) {