acl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Acl-devel] [PATCH acl 2/2] add __acl_ prefixes to internal symbols


From: Mike Frysinger
Subject: [Acl-devel] [PATCH acl 2/2] add __acl_ prefixes to internal symbols
Date: Tue, 12 Aug 2014 08:38:31 -0400

When static linking libacl, people sometimes run into symbol collisions
because their own code defines symbols like "quote".  So for acl internal
symbols, use an __acl_ prefix.
---
 exports                    | 12 ++----------
 include/misc.h             |  8 ++++----
 libacl/__acl_to_any_text.c |  4 ++--
 libacl/acl_from_text.c     |  4 ++--
 libmisc/high_water_alloc.c |  2 +-
 libmisc/next_line.c        |  6 +++---
 libmisc/quote.c            |  4 ++--
 libmisc/unquote.c          |  2 +-
 tools/getfacl.c            |  4 ++--
 tools/parse.c              | 14 +++++++-------
 tools/setfacl.c            |  4 ++--
 11 files changed, 28 insertions(+), 36 deletions(-)

diff --git a/exports b/exports
index 7d8e69e..bf15d84 100644
--- a/exports
+++ b/exports
@@ -59,22 +59,14 @@ ACL_1.0 {
        acl_to_any_text;
 
     local:
-       # Library internal stuff
+       # Library internal stuff
        __new_var_obj_p;
        __new_obj_p_here;
        __free_obj_p;
        __check_obj_p;
        __ext2int_and_check;
-       __acl_reorder_entry_obj_p;
-       __acl_reorder_obj_p;
-       __acl_init_obj;
-       __acl_create_entry_obj;
-       __acl_free_acl_obj;
-       __acl_to_any_text;
+       __acl_*;
        __apply_mask_to_mode;
-
-       quote;
-       unquote;
 };
 
 ACL_1.1 {
diff --git a/include/misc.h b/include/misc.h
index f5c0dae..24b65d2 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -29,12 +29,12 @@
 # define hidden /* hidden */
 #endif
 
-hidden int high_water_alloc(void **buf, size_t *bufsize, size_t newsize);
+hidden int __acl_high_water_alloc(void **buf, size_t *bufsize, size_t newsize);
 
-hidden const char *quote(const char *str, const char *quote_chars);
-hidden char *unquote(char *str);
+hidden const char *__acl_quote(const char *str, const char *quote_chars);
+hidden char *__acl_unquote(char *str);
 
-hidden char *next_line(FILE *file);
+hidden char *__acl_next_line(FILE *file);
 
 #ifdef ENABLE_NLS
 # include <libintl.h>
diff --git a/libacl/__acl_to_any_text.c b/libacl/__acl_to_any_text.c
index 1d10e81..de3925e 100644
--- a/libacl/__acl_to_any_text.c
+++ b/libacl/__acl_to_any_text.c
@@ -159,7 +159,7 @@ acl_entry_to_any_str(const acl_entry_t entry_d, char 
*text_p, ssize_t size,
                                if (options & TEXT_NUMERIC_IDS)
                                        str = NULL;
                                else
-                                       str = quote(user_name(
+                                       str = __acl_quote(user_name(
                                                entry_obj_p->eid.qid), ":, 
\t\n\r");
                                if (str != NULL) {
                                        strncpy(text_p, str, size);
@@ -182,7 +182,7 @@ acl_entry_to_any_str(const acl_entry_t entry_d, char 
*text_p, ssize_t size,
                                if (options & TEXT_NUMERIC_IDS)
                                        str = NULL;
                                else
-                                       str = quote(group_name(
+                                       str = __acl_quote(group_name(
                                                entry_obj_p->eid.qid), ":, 
\t\n\r");
                                if (str != NULL) {
                                        strncpy(text_p, str, size);
diff --git a/libacl/acl_from_text.c b/libacl/acl_from_text.c
index c08bd3b..83a4d21 100644
--- a/libacl/acl_from_text.c
+++ b/libacl/acl_from_text.c
@@ -212,7 +212,7 @@ parse_acl_entry(const char **text_p, acl_t *acl_p)
                        str = get_token(text_p);
                        if (str) {
                                entry_obj.etag = ACL_USER;
-                               error = get_uid(unquote(str),
+                               error = get_uid(__acl_unquote(str),
                                                &entry_obj.eid.qid);
                                free(str);
                                if (error) {
@@ -231,7 +231,7 @@ parse_acl_entry(const char **text_p, acl_t *acl_p)
                        str = get_token(text_p);
                        if (str) {
                                entry_obj.etag = ACL_GROUP;
-                               error = get_gid(unquote(str),
+                               error = get_gid(__acl_unquote(str),
                                                &entry_obj.eid.qid);
                                free(str);
                                if (error) {
diff --git a/libmisc/high_water_alloc.c b/libmisc/high_water_alloc.c
index c127dc1..951f4bb 100644
--- a/libmisc/high_water_alloc.c
+++ b/libmisc/high_water_alloc.c
@@ -21,7 +21,7 @@
 #include <stdlib.h>
 #include "misc.h"
 
-int high_water_alloc(void **buf, size_t *bufsize, size_t newsize)
+int __acl_high_water_alloc(void **buf, size_t *bufsize, size_t newsize)
 {
 #define CHUNK_SIZE     256
        /*
diff --git a/libmisc/next_line.c b/libmisc/next_line.c
index 0566d7a..126a364 100644
--- a/libmisc/next_line.c
+++ b/libmisc/next_line.c
@@ -23,7 +23,7 @@
 
 #define LINE_SIZE getpagesize()
 
-char *next_line(FILE *file)
+char *__acl_next_line(FILE *file)
 {
        static char *line;
        static size_t line_size;
@@ -31,7 +31,7 @@ char *next_line(FILE *file)
        int eol = 0;
 
        if (!line) {
-               if (high_water_alloc((void **)&line, &line_size, LINE_SIZE))
+               if (__acl_high_water_alloc((void **)&line, &line_size, 
LINE_SIZE))
                        return NULL;
        }
        c = line;
@@ -47,7 +47,7 @@ char *next_line(FILE *file)
                if (feof(file))
                        break;
                if (!eol) {
-                       if (high_water_alloc((void **)&line, &line_size,
+                       if (__acl_high_water_alloc((void **)&line, &line_size,
                                             2 * line_size))
                                return NULL;
                        c = strrchr(line, '\0');
diff --git a/libmisc/quote.c b/libmisc/quote.c
index bf8f9eb..a28800c 100644
--- a/libmisc/quote.c
+++ b/libmisc/quote.c
@@ -23,7 +23,7 @@
 #include <string.h>
 #include "misc.h"
 
-const char *quote(const char *str, const char *quote_chars)
+const char *__acl_quote(const char *str, const char *quote_chars)
 {
        static char *quoted_str;
        static size_t quoted_str_len;
@@ -40,7 +40,7 @@ const char *quote(const char *str, const char *quote_chars)
        if (nonpr == 0)
                return str;
 
-       if (high_water_alloc((void **)&quoted_str, &quoted_str_len,
+       if (__acl_high_water_alloc((void **)&quoted_str, &quoted_str_len,
                             (s - (unsigned char *)str) + nonpr * 3 + 1))
                return NULL;
        for (s = (unsigned char *)str, q = quoted_str; *s != '\0'; s++) {
diff --git a/libmisc/unquote.c b/libmisc/unquote.c
index bffebf9..4f4ce7c 100644
--- a/libmisc/unquote.c
+++ b/libmisc/unquote.c
@@ -22,7 +22,7 @@
 #include <ctype.h>
 #include "misc.h"
 
-char *unquote(char *str)
+char *__acl_unquote(char *str)
 {
        unsigned char *s, *t;
 
diff --git a/tools/getfacl.c b/tools/getfacl.c
index 22cc1c7..679affa 100644
--- a/tools/getfacl.c
+++ b/tools/getfacl.c
@@ -89,7 +89,7 @@ int opt_numeric;  /* don't convert id's to symbolic names */
 
 static const char *xquote(const char *str, const char *quote_chars)
 {
-       const char *q = quote(str, quote_chars);
+       const char *q = __acl_quote(str, quote_chars);
        if (q == NULL) {
                fprintf(stderr, "%s: %s\n", progname, strerror(errno));
                exit(1);
@@ -717,7 +717,7 @@ int main(int argc, char *argv[])
        do {
                if (optind == argc ||
                    strcmp(argv[optind], "-") == 0) {
-                       while ((line = next_line(stdin)) != NULL) {
+                       while ((line = __acl_next_line(stdin)) != NULL) {
                                if (*line == '\0')
                                        continue;
 
diff --git a/tools/parse.c b/tools/parse.c
index df69c26..823bfeb 100644
--- a/tools/parse.c
+++ b/tools/parse.c
@@ -226,7 +226,7 @@ user_entry:
                        str = get_token(text_p);
                        if (str) {
                                cmd->c_tag = ACL_USER;
-                               error = get_uid(unquote(str), &cmd->c_id);
+                               error = get_uid(__acl_unquote(str), &cmd->c_id);
                                free(str);
                                if (error) {
                                        *text_p = backup;
@@ -245,7 +245,7 @@ user_entry:
                        str = get_token(text_p);
                        if (str) {
                                cmd->c_tag = ACL_GROUP;
-                               error = get_gid(unquote(str), &cmd->c_id); 
+                               error = get_gid(__acl_unquote(str), &cmd->c_id);
                                free(str);
                                if (error) {
                                        *text_p = backup;
@@ -447,7 +447,7 @@ read_acl_comments(
                if (lineno)
                        (*lineno)++;
 
-               line = next_line(file);
+               line = __acl_next_line(file);
                if (line == NULL)
                        break;
                
@@ -465,7 +465,7 @@ read_acl_comments(
                if (strncmp(cp, "file:", 5) == 0) {
                        cp += 5;
                        SKIP_WS(cp);
-                       cp = unquote(cp);
+                       cp = __acl_unquote(cp);
                        
                        if (path_p) {
                                if (*path_p)
@@ -482,7 +482,7 @@ read_acl_comments(
                        if (uid_p) {
                                if (*uid_p != ACL_UNDEFINED_ID)
                                        goto fail;
-                               if (get_uid(unquote(cp), uid_p) != 0)
+                               if (get_uid(__acl_unquote(cp), uid_p) != 0)
                                        continue;
                        }
                } else if (strncmp(cp, "group:", 6) == 0) {
@@ -492,7 +492,7 @@ read_acl_comments(
                        if (gid_p) {
                                if (*gid_p != ACL_UNDEFINED_ID)
                                        goto fail;
-                               if (get_gid(unquote(cp), gid_p) != 0)
+                               if (get_gid(__acl_unquote(cp), gid_p) != 0)
                                        continue;
                        }
                } else if (strncmp(cp, "flags:", 6) == 0) {
@@ -548,7 +548,7 @@ read_acl_seq(
        if (which)
                *which = -1;
 
-       while ((line = next_line(file))) {
+       while ((line = __acl_next_line(file))) {
                if (lineno)
                        (*lineno)++;
 
diff --git a/tools/setfacl.c b/tools/setfacl.c
index b0ddedf..880bd1e 100644
--- a/tools/setfacl.c
+++ b/tools/setfacl.c
@@ -91,7 +91,7 @@ int promote_warning;
 
 static const char *xquote(const char *str, const char *quote_chars)
 {
-       const char *q = quote(str, quote_chars);
+       const char *q = __acl_quote(str, quote_chars);
        if (q == NULL) {
                fprintf(stderr, "%s: %s\n", progname, strerror(errno));
                exit(1);
@@ -310,7 +310,7 @@ int next_file(const char *arg, seq_t seq)
        args.seq = seq;
 
        if (strcmp(arg, "-") == 0) {
-               while ((line = next_line(stdin)))
+               while ((line = __acl_next_line(stdin)))
                        errors = walk_tree(line, walk_flags, 0, do_set, &args);
                if (!feof(stdin)) {
                        fprintf(stderr, _("%s: Standard input: %s\n"),
-- 
2.0.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]