[asterisk-commits] murf: trunk r82268 - in /trunk: main/config.c utils/Makefile

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 11 17:37:20 CDT 2007


Author: murf
Date: Tue Sep 11 17:37:20 2007
New Revision: 82268

URL: http://svn.digium.com/view/asterisk?view=rev&rev=82268
Log:
This solves an unreported solaris compile problem (missing -lnsl -lsocket).

Modified:
    trunk/main/config.c
    trunk/utils/Makefile

Modified: trunk/main/config.c
URL: http://svn.digium.com/view/asterisk/trunk/main/config.c?view=diff&rev=82268&r1=82267&r2=82268
==============================================================================
--- trunk/main/config.c (original)
+++ trunk/main/config.c Tue Sep 11 17:37:20 2007
@@ -1159,6 +1159,12 @@
 					process_buf = NULL;
 				else
 					process_buf = buf;
+				
+				if (ast_test_flag(&flags, CONFIG_FLAG_WITHCOMMENTS) && comment_buffer && comment_buffer[0] && (ast_strlen_zero(buf) || strlen(buf) == strspn(buf," \t\n\r"))) {
+					/* blank line? really? Can we add it to an existing comment and maybe preserve inter- and post- comment spacing? */
+					CB_ADD(&comment_buffer, &comment_buffer_size, "\n");       /* add a newline to the comment buffer */
+					continue; /* go get a new line, then */
+				}
 				
 				while ((comment_p = strchr(new_buf, COMMENT_META))) {
 					if ((comment_p > new_buf) && (*(comment_p-1) == '\\')) {
@@ -1228,10 +1234,14 @@
 		/* end of file-- anything in a comment buffer? */
 		if (last_cat) {
 			if (ast_test_flag(&flags, CONFIG_FLAG_WITHCOMMENTS) && comment_buffer && comment_buffer[0] ) {
+				CB_ADD(&comment_buffer, &comment_buffer_size, lline_buffer);       /* add the current lline buffer to the comment buffer */
+				lline_buffer[0] = 0;        /* erase the lline buffer */
 				last_cat->trailing = ALLOC_COMMENT(comment_buffer);
 			}
 		} else if (last_var) {
 			if (ast_test_flag(&flags, CONFIG_FLAG_WITHCOMMENTS) && comment_buffer && comment_buffer[0] ) {
+				CB_ADD(&comment_buffer, &comment_buffer_size, lline_buffer);       /* add the current lline buffer to the comment buffer */
+				lline_buffer[0] = 0;        /* erase the lline buffer */
 				last_var->trailing = ALLOC_COMMENT(comment_buffer);
 			}
 		} else {
@@ -1321,6 +1331,27 @@
 		ast_copy_string(fn, file, fn_size);
 	else
 		snprintf(fn, fn_size, "%s/%s", ast_config_AST_CONFIG_DIR, file);
+}
+
+static int count_linefeeds(char *str)
+{
+	int count = 0;
+	while (*str) {
+		if (*str =='\n')
+			count++;
+	}
+	return count;
+}
+
+static int count_linefeeds_in_comments(struct ast_comment *x)
+{
+	int count = 0;
+	while (x)
+	{
+		count += count_linefeeds(x->cmt);
+		x = x->next;
+	}
+	return count;
 }
 
 int config_text_file_save(const char *configfile, const struct ast_config *cfg, const char *generator)

Modified: trunk/utils/Makefile
URL: http://svn.digium.com/view/asterisk/trunk/utils/Makefile?view=diff&rev=82268&r1=82267&r2=82268
==============================================================================
--- trunk/utils/Makefile (original)
+++ trunk/utils/Makefile Tue Sep 11 17:37:20 2007
@@ -132,7 +132,7 @@
 	$(CC) -g -O0 -c hashtest2.c $(PTHREAD_CFLAGS) -I/usr/include -I../include
 
 hashtest2 : hashtest2.o md5.o utils.o astobj2.o sha1.o strcompat.o
-	$(CC) -g -O0 -o hashtest2 hashtest2.o astobj2.o utils.o md5.o sha1.o strcompat.o $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
+	$(CC) -g -O0 -o hashtest2 hashtest2.o astobj2.o utils.o md5.o sha1.o strcompat.o $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(LIBS)
 
 extconf.o : extconf.c
 




More information about the asterisk-commits mailing list