[Asterisk-cvs] asterisk config.c,1.69,1.70 utils.c,1.52,1.53

kpfleming at lists.digium.com kpfleming at lists.digium.com
Fri Jun 24 18:44:49 CDT 2005


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv30988

Modified Files:
	config.c utils.c 
Log Message:
split up string/time functions into separate header files
make more LOW_MEMORY optimizations, and ensure that a non-inline version of each inlinable function is always available (for external modules)
move compiler-specific stuff into a separate header file


Index: config.c
===================================================================
RCS file: /usr/cvsroot/asterisk/config.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- config.c	21 Jun 2005 19:09:35 -0000	1.69
+++ config.c	24 Jun 2005 22:45:15 -0000	1.70
@@ -82,36 +82,6 @@
 	int max_include_level;
 };
 
-int ast_true(const char *s)
-{
-	if (!s)
-		return 0;
-	/* Determine if this is a true value */
-	if (!strcasecmp(s, "yes") ||
-	    !strcasecmp(s, "true") ||
-	    !strcasecmp(s, "y") ||
-	    !strcasecmp(s, "t") ||
-	    !strcasecmp(s, "1") ||
-	    !strcasecmp(s, "on"))
-		return -1;
-	return 0;
-}
-
-int ast_false(const char *s)
-{
-	if (!s)
-		return 0;
-	/* Determine if this is a false value */
-	if (!strcasecmp(s, "no") ||
-	    !strcasecmp(s, "false") ||
-	    !strcasecmp(s, "n") ||
-	    !strcasecmp(s, "f") ||
-	    !strcasecmp(s, "0") ||
-	    !strcasecmp(s, "off"))
-		return -1;
-	return 0;
-}
-
 struct ast_variable *ast_variable_new(const char *name, const char *value) 
 {
 	struct ast_variable *variable;

Index: utils.c
===================================================================
RCS file: /usr/cvsroot/asterisk/utils.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- utils.c	23 Jun 2005 23:07:55 -0000	1.52
+++ utils.c	24 Jun 2005 22:45:15 -0000	1.53
@@ -34,28 +34,17 @@
 #include "asterisk/md5.h"
 
 #define AST_API_MODULE		/* ensure that inlinable API functions will be built in this module if required */
+#include "asterisk/strings.h"
+
+#define AST_API_MODULE		/* ensure that inlinable API functions will be built in this module if required */
+#include "asterisk/time.h"
+
+#define AST_API_MODULE		/* ensure that inlinable API functions will be built in this module if required */
 #include "asterisk/utils.h"
 
 static char base64[64];
 static char b2a[256];
 
-char *ast_strip_quoted(char *s, const char *beg_quotes, const char *end_quotes)
-{
-	char *e;
-	char *q;
-
-	s = ast_strip(s);
-	if ((q = strchr(beg_quotes, *s))) {
-		e = s + strlen(s) - 1;
-		if (*e == *(end_quotes + (q - beg_quotes))) {
-			s++;
-			*e = '\0';
-		}
-	}
-
-	return s;
-}
-
 #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined( __NetBSD__ ) || defined(__APPLE__)
 
 /* duh? ERANGE value copied from web... */
@@ -433,6 +422,23 @@
 	return poll(pfd, 1, ms);
 }
 
+char *ast_strip_quoted(char *s, const char *beg_quotes, const char *end_quotes)
+{
+	char *e;
+	char *q;
+
+	s = ast_strip(s);
+	if ((q = strchr(beg_quotes, *s))) {
+		e = s + strlen(s) - 1;
+		if (*e == *(end_quotes + (q - beg_quotes))) {
+			s++;
+			*e = '\0';
+		}
+	}
+
+	return s;
+}
+
 int ast_build_string(char **buffer, size_t *space, const char *fmt, ...)
 {
 	va_list ap;
@@ -455,6 +461,40 @@
 	return 0;
 }
 
+int ast_true(const char *s)
+{
+	if (!s || ast_strlen_zero(s))
+		return 0;
+
+	/* Determine if this is a true value */
+	if (!strcasecmp(s, "yes") ||
+	    !strcasecmp(s, "true") ||
+	    !strcasecmp(s, "y") ||
+	    !strcasecmp(s, "t") ||
+	    !strcasecmp(s, "1") ||
+	    !strcasecmp(s, "on"))
+		return -1;
+
+	return 0;
+}
+
+int ast_false(const char *s)
+{
+	if (!s || ast_strlen_zero(s))
+		return 0;
+
+	/* Determine if this is a false value */
+	if (!strcasecmp(s, "no") ||
+	    !strcasecmp(s, "false") ||
+	    !strcasecmp(s, "n") ||
+	    !strcasecmp(s, "f") ||
+	    !strcasecmp(s, "0") ||
+	    !strcasecmp(s, "off"))
+		return -1;
+
+	return 0;
+}
+
 /* Case-insensitive substring matching */
 #ifndef LINUX
 static char *upper(const char *orig, char *buf, int bufsize)




More information about the svn-commits mailing list