[svn:DBD-Pg] r14640 - DBD-Pg/trunk

[email protected]
Newsgroups gmane.comp.db.postgresql.dbdpg.cvs
Message-ID <[email protected]>
Author: turnstep
Date: Wed Jan 12 09:29:57 2011
New Revision: 14640

Modified:
   DBD-Pg/trunk/quote.c

Log:
Do not return inside void functions to make picky compilers happy.


Modified: DBD-Pg/trunk/quote.c
==============================================================================
--- DBD-Pg/trunk/quote.c	(original)
+++ DBD-Pg/trunk/quote.c	Wed Jan 12 09:29:57 2011
@@ -449,37 +449,35 @@
 
 	(*retlen) = 0;
 
-	if (NULL == string)
-			return;
+	if (NULL != string) {
+		result = string;
 
-	result = string;
-
-	while (*string != '\0') {
-		(*retlen)++;
-		if ('\\' == *string) {
-			if ('\\' == *(string+1)) {
-				*result++ = '\\';
-				string +=2;
-			}
-			else if (
-				 (*(string+1) >= '0' && *(string+1) <= '3') &&
-				 (*(string+2) >= '0' && *(string+2) <= '7') &&
-				 (*(string+3) >= '0' && *(string+3) <= '7'))
-				{
-					*result++ = (*(string+1)-'0')*64 + (*(string+2)-'0')*8 + (*(string+3)-'0');
-					string += 4;
+		while (*string != '\0') {
+			(*retlen)++;
+			if ('\\' == *string) {
+				if ('\\' == *(string+1)) {
+					*result++ = '\\';
+					string +=2;
+				}
+				else if (
+						 (*(string+1) >= '0' && *(string+1) <= '3') &&
+						 (*(string+2) >= '0' && *(string+2) <= '7') &&
+						 (*(string+3) >= '0' && *(string+3) <= '7'))
+					{
+						*result++ = (*(string+1)-'0')*64 + (*(string+2)-'0')*8 + (*(string+3)-'0');
+						string += 4;
+					}
+				else { /* Invalid escape sequence - ignore the backslash */
+					(*retlen)--;
+					string++;
 				}
-			else { /* Invalid escape sequence - ignore the backslash */
-				(*retlen)--;
-				string++;
+			}
+			else {
+				*result++ = *string++;
 			}
 		}
-		else {
-			*result++ = *string++;
-		}
+		*result = '\0';
 	}
-	*result = '\0';
-	return;
 }
 
 static int _decode_hex_digit(char digit)
@@ -502,37 +500,33 @@
 
 	(*retlen) = 0;
 
-	if (NULL == string)
-		return;
+	if (NULL != string) {
+		result = string;
 
-	result = string;
-
-	while (*string != '\0') {
-		int digit1, digit2;
-		digit1 = _decode_hex_digit(*string);
-		digit2 = _decode_hex_digit(*(string+1));
-		if (digit1 >= 0 && digit2 >= 0) {
-			*result++ = 16 * digit1 + digit2;
-			(*retlen)++;
+		while (*string != '\0') {
+			int digit1, digit2;
+			digit1 = _decode_hex_digit(*string);
+			digit2 = _decode_hex_digit(*(string+1));
+			if (digit1 >= 0 && digit2 >= 0) {
+				*result++ = 16 * digit1 + digit2;
+				(*retlen)++;
+			}
+			string += 2;
 		}
-		string += 2;
+		*result = '\0';
 	}
-	*result = '\0';
-	return;
 }
 
 void dequote_bytea(char *string, STRLEN *retlen, int estring)
 {
 	dTHX;
 
-	if (NULL == string)
-		return;
-
-	if ('\\' == *string && 'x' == *(string+1))
-		_dequote_bytea_hex(string, retlen, estring);
-	else
-		_dequote_bytea_escape(string, retlen, estring);
-	return;
+	if (NULL != string) {
+		if ('\\' == *string && 'x' == *(string+1))
+			_dequote_bytea_hex(string, retlen, estring);
+		else
+			_dequote_bytea_escape(string, retlen, estring);
+	}
 }
 
 /*
@@ -547,7 +541,7 @@
 	/* We are going to return a dequote_bytea(), just in case */
 	warn("Use of SQL_BINARY invalid in dequote()");
 	dequote_bytea(string, retlen, estring);
-	return;
+
 	/* Put dequote_sql_binary function here at some point */
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.