Sfoglia il codice sorgente

libdpkg: Suffix path related function names with ‘path_’

Guillem Jover 17 anni fa
parent
commit
d5ad25d854
7 ha cambiato i file con 21 aggiunte e 21 eliminazioni
  1. 2 2
      lib/dpkg-priv.h
  2. 1 1
      lib/fields.c
  3. 2 2
      lib/path.c
  4. 13 13
      lib/test/t-path.c
  5. 1 1
      src/filesdb.c
  6. 1 1
      src/help.c
  7. 1 1
      src/query.c

+ 2 - 2
lib/dpkg-priv.h

@@ -50,8 +50,8 @@ char *str_escape_fmt(char *dest, const char *src);
 
 /* Path handling. */
 
-size_t rtrim_slash_slashdot(char *path);
-const char *skip_slash_dotslash(const char *path);
+size_t path_rtrim_slash_slashdot(char *path);
+const char *path_skip_slash_dotslash(const char *path);
 
 /* Subprocess handling. */
 

+ 1 - 1
lib/fields.c

@@ -285,7 +285,7 @@ void f_conffiles(struct pkginfo *pigp, struct pkginfoperfile *pifp,
 			  &hashstart, &hashlen, &endfn,
                           filename, lno, pigp);
     newlink= nfmalloc(sizeof(struct conffile));
-    value= skip_slash_dotslash(value);
+    value = path_skip_slash_dotslash(value);
     namelen= (int)(endfn-value);
     if (namelen <= 0)
       parse_error(filename, lno, pigp,

+ 2 - 2
lib/path.c

@@ -27,7 +27,7 @@
 #include <dpkg-priv.h>
 
 size_t
-rtrim_slash_slashdot(char *path)
+path_rtrim_slash_slashdot(char *path)
 {
 	char *end;
 
@@ -45,7 +45,7 @@ rtrim_slash_slashdot(char *path)
 }
 
 const char *
-skip_slash_dotslash(const char *path)
+path_skip_slash_dotslash(const char *path)
 {
 	while (path[0] == '/' || (path[0] == '.' && path[1] == '/'))
 		path++;

+ 13 - 13
lib/test/t-path.c

@@ -29,7 +29,7 @@
 #define test_trim_eq_ref(p, ref) \
 do { \
 	char *t = strdup((p)); \
-	rtrim_slash_slashdot(t); \
+	path_rtrim_slash_slashdot(t); \
 	test_str(t, ==, (ref)); \
 	free(t); \
 } while (0)
@@ -55,18 +55,18 @@ test_path_rtrim(void)
 static void
 test_path_skip(void)
 {
-	test_str(skip_slash_dotslash("./././."), ==, ".");
-	test_str(skip_slash_dotslash("./././"), ==, "");
-	test_str(skip_slash_dotslash("./."), ==, ".");
-	test_str(skip_slash_dotslash("./"), ==, "");
-	test_str(skip_slash_dotslash("/./././."), ==, ".");
-	test_str(skip_slash_dotslash("/./"), ==, "");
-	test_str(skip_slash_dotslash("/."), ==, ".");
-	test_str(skip_slash_dotslash("/"), ==, "");
-	test_str(skip_slash_dotslash("/./../."), ==, "../.");
-	test_str(skip_slash_dotslash("/foo/bar/./"), ==, "foo/bar/./");
-	test_str(skip_slash_dotslash("./foo/bar/./"), ==, "foo/bar/./");
-	test_str(skip_slash_dotslash("/./foo/bar/./"), ==, "foo/bar/./");
+	test_str(path_skip_slash_dotslash("./././."), ==, ".");
+	test_str(path_skip_slash_dotslash("./././"), ==, "");
+	test_str(path_skip_slash_dotslash("./."), ==, ".");
+	test_str(path_skip_slash_dotslash("./"), ==, "");
+	test_str(path_skip_slash_dotslash("/./././."), ==, ".");
+	test_str(path_skip_slash_dotslash("/./"), ==, "");
+	test_str(path_skip_slash_dotslash("/."), ==, ".");
+	test_str(path_skip_slash_dotslash("/"), ==, "");
+	test_str(path_skip_slash_dotslash("/./../."), ==, "../.");
+	test_str(path_skip_slash_dotslash("/foo/bar/./"), ==, "foo/bar/./");
+	test_str(path_skip_slash_dotslash("./foo/bar/./"), ==, "foo/bar/./");
+	test_str(path_skip_slash_dotslash("/./foo/bar/./"), ==, "foo/bar/./");
 }
 
 static void

+ 1 - 1
src/filesdb.c

@@ -392,7 +392,7 @@ struct filenamenode *findnamenode(const char *name, enum fnnflags flags) {
   const char *orig_name = name;
 
   /* We skip initial slashes and ./ pairs, and add our own single leading slash. */
-  name= skip_slash_dotslash(name);
+  name = path_skip_slash_dotslash(name);
 
   pointerp= bins + (hash(name) & (BINS-1));
   while (*pointerp) {

+ 1 - 1
src/help.c

@@ -523,7 +523,7 @@ void ensure_pathname_nonexisting(const char *pathname) {
   int c1;
   const char *u, *failed;
 
-  u= skip_slash_dotslash(pathname);
+  u = path_skip_slash_dotslash(pathname);
   assert(*u);
 
   debug(dbg_eachfile,"ensure_pathname_nonexisting `%s'",pathname);

+ 1 - 1
src/query.c

@@ -246,7 +246,7 @@ void searchfiles(const char *const *argv) {
       varbufaddstr(&path, thisarg);
       varbufaddc(&path, '\0');
 
-      path.used = rtrim_slash_slashdot(path.buf);
+      path.used = path_rtrim_slash_slashdot(path.buf);
       thisarg = path.buf;
     }