summaryrefslogtreecommitdiffstats
path: root/shlibs/mount/src/tab_parse.c
diff options
context:
space:
mode:
authorKarel Zak2010-06-07 12:57:03 +0200
committerKarel Zak2010-06-07 12:57:03 +0200
commit7043ced3d98e19e9e9daa832368d5a68e931524c (patch)
tree1678abbff9434f74bb1e455f6e959d0ff61219f5 /shlibs/mount/src/tab_parse.c
parentlibmount: fix Makefile.am (diff)
downloadkernel-qcow2-util-linux-7043ced3d98e19e9e9daa832368d5a68e931524c.tar.gz
kernel-qcow2-util-linux-7043ced3d98e19e9e9daa832368d5a68e931524c.tar.xz
kernel-qcow2-util-linux-7043ced3d98e19e9e9daa832368d5a68e931524c.zip
libmount: use mangle function from lib/
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/mount/src/tab_parse.c')
-rw-r--r--shlibs/mount/src/tab_parse.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/shlibs/mount/src/tab_parse.c b/shlibs/mount/src/tab_parse.c
index e103aad8e..5dbcfa673 100644
--- a/shlibs/mount/src/tab_parse.c
+++ b/shlibs/mount/src/tab_parse.c
@@ -11,6 +11,7 @@
#include <limits.h>
#include "nls.h"
+#include "mangle.h"
#include "mountP.h"
static inline char *skip_spaces(char *s)
@@ -31,29 +32,6 @@ static inline char *skip_nonspaces(char *s)
return s;
}
-#define isoctal(a) (((a) & ~7) == '0')
-
-/* returns malloced pointer - no more strdup required */
-static void unmangle(char *s, char *buf, size_t len)
-{
- size_t sz = 0;
- assert(s);
-
- while(*s && sz < len - 1) {
- if (*s == '\\' && sz + 4 < len - 1 && isoctal(s[1]) &&
- isoctal(s[2]) && isoctal(s[3])) {
-
- *buf++ = 64*(s[1] & 7) + 8*(s[2] & 7) + (s[3] & 7);
- s += 4;
- sz += 4;
- } else {
- *buf++ = *s++;
- sz++;
- }
- }
- *buf = '\0';
-}
-
static size_t next_word_size(char *s, char **start, char **end)
{
char *e;
@@ -88,7 +66,7 @@ static char *next_word(char **s)
if (!res)
return NULL;
- unmangle(*s, res, sz);
+ unmangle_to_buffer(*s, res, sz);
*s = end + 1;
return res;
}