use libname as prefix for all funcs
Stefan Schuermans

Stefan Schuermans commited on 2020-05-17 18:59:26
Showing 5 changed files, with 15 additions and 14 deletions.

... ...
@@ -27,17 +27,17 @@ int lwptev_proc_begin(void **data, size_t *size) {
27 27
   proc_begin.pid = getpid();
28 28
   proc_begin.has_ppid = 1;
29 29
   proc_begin.ppid = getppid();
30
-  if (symlink_read("/proc/self/exe", &proc_begin.exe, cleaner) != 0) {
30
+  if (lwptev_symlink_read("/proc/self/exe", &proc_begin.exe, cleaner) != 0) {
31 31
     return -1;
32 32
   }
33
-  if (symlink_read("/proc/self/cwd", &proc_begin.cwd, cleaner) != 0) {
33
+  if (lwptev_symlink_read("/proc/self/cwd", &proc_begin.cwd, cleaner) != 0) {
34 34
     return -1;
35 35
   }
36
-  if (stringlist_read("/proc/self/cmdline", &proc_begin.n_cmdline,
36
+  if (lwptev_stringlist_read("/proc/self/cmdline", &proc_begin.n_cmdline,
37 37
                              &proc_begin.cmdline, cleaner) != 0) {
38 38
     return -1;
39 39
   }
40
-  if (stringlist_read("/proc/self/environ", &proc_begin.n_environ,
40
+  if (lwptev_stringlist_read("/proc/self/environ", &proc_begin.n_environ,
41 41
                              &proc_begin.environ, cleaner) != 0) {
42 42
     return -1;
43 43
   }
... ...
@@ -14,7 +14,7 @@
14 14
  * @param[out] *size size of file contents
15 15
  * @return pointer to malloc-ed file contents or NULL
16 16
  */
17
-static char * stringlist_read_file(char const *pathname, size_t *size) {
17
+static char * lwptev_stringlist_read_file(char const *pathname, size_t *size) {
18 18
   /* it is not possible to get file size before, because this yields zero for
19 19
      files like /proc/self/cmdline */
20 20
   *size = 0;
... ...
@@ -71,7 +71,8 @@ static char * stringlist_read_file(char const *pathname, size_t *size) {
71 71
  * @param[out] *cnt number of entries in array
72 72
  * @return pointer to malloc-ed array of NULL
73 73
  */
74
-static char ** stringlist_make_ptrs(char *data, size_t sz, size_t *cnt) {
74
+static char ** lwptev_stringlist_make_ptrs(char *data, size_t sz,
75
+                                           size_t *cnt) {
75 76
   /* count strings */
76 77
   size_t pos = 0;
77 78
   *cnt = 0;
... ...
@@ -94,13 +95,13 @@ static char ** stringlist_make_ptrs(char *data, size_t sz, size_t *cnt) {
94 95
   return ptrs;
95 96
 }
96 97
 
97
-int stringlist_read(char const *pathname, size_t *n, char ***strs,
98
+int lwptev_stringlist_read(char const *pathname, size_t *n, char ***strs,
98 99
                            lwptev_cleaner_t *cleaner) {
99 100
   *n = 0;
100 101
   *strs = NULL;
101 102
   /* read file contents */
102 103
   size_t sz;
103
-  char *data = stringlist_read_file(pathname, &sz);
104
+  char *data = lwptev_stringlist_read_file(pathname, &sz);
104 105
   if (! data) {
105 106
     lwptev_cleaner_cleanup(cleaner);
106 107
     return -1;
... ...
@@ -108,7 +109,7 @@ int stringlist_read(char const *pathname, size_t *n, char ***strs,
108 109
   lwptev_cleaner_add_ptr(cleaner, data);
109 110
   /* create pointer array */
110 111
   size_t cnt;
111
-  char **ptrs = stringlist_make_ptrs(data, sz, &cnt);
112
+  char **ptrs = lwptev_stringlist_make_ptrs(data, sz, &cnt);
112 113
   if (! ptrs) {
113 114
     lwptev_cleaner_cleanup(cleaner);
114 115
     return -1;
... ...
@@ -14,7 +14,7 @@
14 14
  * @return 0 on success, -1 on error
15 15
  *         (on error, cleanup is done and cleaner is deallocated)
16 16
  */
17
-int stringlist_read(char const *pathname, size_t *n, char ***strs,
17
+int lwptev_stringlist_read(char const *pathname, size_t *n, char ***strs,
18 18
                            lwptev_cleaner_t *cleaner);
19 19
 
20 20
 #endif /* #ifndef LWPTTR_STRINGLIST_H */
... ...
@@ -9,7 +9,7 @@
9 9
  * @param[in] pathname path to symbolic link
10 10
  * @return malloc-ed string containting link target or NULL
11 11
  */
12
-static char * symlink_read_target(char const *pathname) {
12
+static char * lwptev_symlink_read_target(char const *pathname) {
13 13
   size_t sz = 256;
14 14
   char *target = NULL;
15 15
   while (1) {
... ...
@@ -35,9 +35,9 @@ static char * symlink_read_target(char const *pathname) {
35 35
   }
36 36
 }
37 37
 
38
-int symlink_read(char const *pathname, char **target,
38
+int lwptev_symlink_read(char const *pathname, char **target,
39 39
                         lwptev_cleaner_t *cleaner) {
40
-  *target = symlink_read_target(pathname);
40
+  *target = lwptev_symlink_read_target(pathname);
41 41
   if (! *target) {
42 42
     lwptev_cleaner_cleanup(cleaner);
43 43
     return -1;
... ...
@@ -11,7 +11,7 @@
11 11
  * @return 0 on success, -1 on error
12 12
  *         (on error, cleanup is done and cleaner is deallocated)
13 13
  */
14
-int symlink_read(char const *pathname, char **target,
14
+int lwptev_symlink_read(char const *pathname, char **target,
15 15
                         lwptev_cleaner_t *cleaner);
16 16
 
17 17
 #endif /* #ifndef LWPTTR_SYMLINK_H */
18 18