[svn-commits] seanbright: tools/trunk r6888 - /tools/trunk/tonezone.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jul 23 12:57:30 CDT 2009


Author: seanbright
Date: Thu Jul 23 12:57:27 2009
New Revision: 6888

URL: http://svn.asterisk.org/svn-view/dahdi?view=rev&rev=6888
Log:
Convert a series of preprocessor "#if 0" into a macro (PRINT_DEBUG).

Modified:
    tools/trunk/tonezone.c

Modified: tools/trunk/tonezone.c
URL: http://svn.asterisk.org/svn-view/dahdi/tools/trunk/tonezone.c?view=diff&rev=6888&r1=6887&r2=6888
==============================================================================
--- tools/trunk/tonezone.c (original)
+++ tools/trunk/tonezone.c Thu Jul 23 12:57:27 2009
@@ -46,6 +46,12 @@
 #define CLIP 32635
 #define BIAS 0x84
 
+#if 0
+# define PRINT_DEBUG(x, ...) printf(x, __VA_ARGS__)
+#else
+# define PRINT_DEBUG(x, ...)
+#endif
+
 struct tone_zone *tone_zone_find(char *country)
 {
 	struct tone_zone *z;
@@ -88,42 +94,28 @@
 		if (s[0] == '!') 
 			s++;
 		else if (firstnobang < 0) {
-#if 0
-			printf("First no bang: %s\n", s);
-#endif			
+			PRINT_DEBUG("First no bang: %s\n", s);
 			firstnobang = *count;
 		}
 		if (sscanf(s, "%d+%d/%d", &freq1, &freq2, &time) == 3) {
 			/* f1+f2/time format */
-#if 0
-			printf("f1+f2/time format: %d, %d, %d\n", freq1, freq2, time);
-#endif			
+			PRINT_DEBUG("f1+f2/time format: %d, %d, %d\n", freq1, freq2, time);
 		} else if (sscanf(s, "%d*%d/%d", &freq1, &freq2, &time) == 3) {
 			/* f1*f2/time format */
+			PRINT_DEBUG("f1+f2/time format: %d, %d, %d\n", freq1, freq2, time);
 			modulate = 1;
-#if 0
-			printf("f1+f2/time format: %d, %d, %d\n", freq1, freq2, time);
-#endif			
 		} else if (sscanf(s, "%d+%d", &freq1, &freq2) == 2) {
-#if 0
-			printf("f1+f2 format: %d, %d\n", freq1, freq2);
-#endif			
+			PRINT_DEBUG("f1+f2 format: %d, %d\n", freq1, freq2);
 			time = 0;
 		} else if (sscanf(s, "%d*%d", &freq1, &freq2) == 2) {
+			PRINT_DEBUG("f1+f2 format: %d, %d\n", freq1, freq2);
 			modulate = 1;
-#if 0
-			printf("f1+f2 format: %d, %d\n", freq1, freq2);
-#endif			
 			time = 0;
 		} else if (sscanf(s, "%d/%d", &freq1, &time) == 2) {
-#if 0
-			printf("f1/time format: %d, %d\n", freq1, time);
-#endif			
+			PRINT_DEBUG("f1/time format: %d, %d\n", freq1, time);
 			freq2 = 0;
 		} else if (sscanf(s, "%d", &freq1) == 1) {
-#if 0		
-			printf("f1 format: %d\n", freq1);
-#endif			
+			PRINT_DEBUG("f1 format: %d\n", freq1);
 			firstnobang = *count;
 			freq2 = 0;
 			time = 0;
@@ -131,9 +123,9 @@
 			fprintf(stderr, "tone component '%s' of '%s' is a syntax error\n", s,t->data);
 			return -1;
 		}
-#if 0
-		printf("Using %d samples for %d and %d\n", time * 8, freq1, freq2);
-#endif
+
+		PRINT_DEBUG("Using %d samples for %d and %d\n", time * 8, freq1, freq2);
+
 		if (size < sizeof(*td)) {
 			fprintf(stderr, "Not enough space for tones\n");
 			return -1;
@@ -380,9 +372,8 @@
 		if (!strlen(z->tones[x].data))
 			continue;
 
-#if 0
-		printf("Tone: %d, string: %s\n", z->tones[x].toneid, z->tones[x].data);
-#endif			
+		PRINT_DEBUG("Tone: %d, string: %s\n", z->tones[x].toneid, z->tones[x].data);
+
 		if ((res = build_tone(ptr, space, &z->tones[x], &count)) < 0) {
 			fprintf(stderr, "Tone %d not built.\n", x);
 			return -1;




More information about the svn-commits mailing list