From 7043ced3d98e19e9e9daa832368d5a68e931524c Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 7 Jun 2010 12:57:03 +0200 Subject: libmount: use mangle function from lib/ Signed-off-by: Karel Zak --- shlibs/mount/src/tab_parse.c | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'shlibs/mount/src/tab_parse.c') 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 #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; } -- cgit v1.2.3-55-g7522