[Devel] General handling of special cases if perferred

Igor Podlesny openvz at poige.ru
Sun Apr 28 20:31:54 PDT 2013


---
 src/lib/util.c |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/lib/util.c b/src/lib/util.c
index 8cc066b..420a574 100644
--- a/src/lib/util.c
+++ b/src/lib/util.c
@@ -46,18 +46,17 @@ static const char *unescapestr(char *const src)
 	char *p1, *p2;
 	int fl = 0;
 
-	if (src == NULL)
-		return NULL;
-	
-	for (p1 = p2 = src; *p2; ++p2) {
-		if (*p2 == '\\' && !fl)	{
-			fl = 1;
-		} else {
-			*p1++ = *p2;
-			fl = 0;
+	if (src != NULL) {
+		for (p1 = p2 = src; *p2; ++p2) {
+			if (*p2 == '\\' && !fl)	{
+				fl = 1;
+			} else {
+				*p1++ = *p2;
+				fl = 0;
+			}
 		}
+		*p1 = 0;
 	}
-	*p1 = 0;
 
 	return src;
 }
-- 
1.7.9.5




More information about the Devel mailing list