]> git.proxmox.com Git - mirror_lxc.git/commitdiff
string_utils: add remove_trailing_slashes()
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 22 Aug 2018 13:45:33 +0000 (15:45 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 22 Aug 2018 13:54:24 +0000 (15:54 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/initutils.c
src/lxc/initutils.h
src/lxc/string_utils.c
src/lxc/string_utils.h

index 9e5397aa698781fe921a0dde9eab01f1fe318724..c582b2d0063353b93bbd58a6b38860e41d2f02ed 100644 (file)
@@ -217,13 +217,6 @@ out:
        return values[i];
 }
 
-extern void remove_trailing_slashes(char *p)
-{
-       int l = strlen(p);
-       while (--l >= 0 && (p[l] == '/' || p[l] == '\n'))
-               p[l] = '\0';
-}
-
 /*
  * Sets the process title to the specified title. Note that this may fail if
  * the kernel doesn't support PR_SET_MM_MAP (kernels <3.18).
index 6753956cee4dc46608fca48a27f007d7c61c3886..4af8c3e6ca720573b3fee6c833a8a1324477f015 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef __LXC_INITUTILS_H
 #define __LXC_INITUTILS_H
 
+#include "config.h"
+
 #include <errno.h>
 #include <fcntl.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include <sys/mount.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <unistd.h>
 
-#include "config.h"
+#include "string_utils.h"
 
 #define DEFAULT_VG "lxc"
 #define DEFAULT_THIN_POOL "lxc"
@@ -70,7 +72,6 @@ struct prctl_mm_map {
 
 extern const char *lxc_global_config_value(const char *option_name);
 
-extern void remove_trailing_slashes(char *p);
 extern int setproctitle(char *title);
 
 #endif /* __LXC_INITUTILS_H */
index 633255c5c77fbc91fa5752eb21b9dd8caaaa8485..74cea3c704a4f1677b7e86890e4fa4ac731f7126 100644 (file)
@@ -978,3 +978,10 @@ int lxc_is_line_empty(const char *line)
                        return 0;
        return 1;
 }
+
+void remove_trailing_slashes(char *p)
+{
+       int l = strlen(p);
+       while (--l >= 0 && (p[l] == '/' || p[l] == '\n'))
+               p[l] = '\0';
+}
index 211c6c8661a2ca78c7265993b6f61578634871d7..d289d18e0c38b8b985f9905d4c79b05545f1b6c3 100644 (file)
@@ -111,5 +111,6 @@ extern int lxc_char_right_gc(const char *buffer, size_t len);
 extern char *lxc_trim_whitespace_in_place(char *buffer);
 
 extern int lxc_is_line_empty(const char *line);
+extern void remove_trailing_slashes(char *p);
 
 #endif /* __LXC_STRING_UTILS_H */