Snort mailing list archives
[SNORT-DEVEL] modification to switch()/case in snprintf.c for NetVI
From: Bill Parker <wp02855 () gmail com>
Date: Sun, 13 Apr 2014 12:27:46 -0700
Hello All,
In reviewing some code in NetVI, directory 'src', file 'snprintf.c'
I found a rather lengthy switch()/case workup consisting of the following:
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
Which could be written as:
case '1' ... '9':
since ASCII values for '1' thru '9' are in order in the ASCII
table. The patch file which modifies this is below:
--- snprintf.c.orig 2014-04-10 04:39:57.132977816 -0700
+++ snprintf.c 2014-04-10 04:40:45.194086136 -0700
@@ -174,15 +174,7 @@
case '-': ljust = 1; goto nextch;
case '0': /* set zero padding if len not set */
if(len==0 && !pointflag) zpad = '0';
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
+ case '1' ... '9':
if(pointflag)
maxwidth = maxwidth*10 + ch - '0';
else
Would this be of any use in NetVI and/or Snort/DAQ?
Bill Parker (wp02855 at gmail dot com)
Attachment:
netvi_snprintf.c.patch
Description:
------------------------------------------------------------------------------ Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test & Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________ Snort-devel mailing list Snort-devel () lists sourceforge net https://lists.sourceforge.net/lists/listinfo/snort-devel Archive: http://sourceforge.net/mailarchive/forum.php?forum_name=snort-devel Please visit http://blog.snort.org for the latest news about Snort!
Current thread:
- [SNORT-DEVEL] modification to switch()/case in snprintf.c for NetVI Bill Parker (Apr 13)
- Re: [SNORT-DEVEL] modification to switch()/case in snprintf.c for NetVI Joshua Kinard (Apr 13)
- Re: [SNORT-DEVEL] modification to switch()/case in snprintf.c for NetVI Joel Esler (jesler) (Apr 13)
- Re: [SNORT-DEVEL] modification to switch()/case in snprintf.c for NetVI Joshua Kinard (Apr 14)
- Re: [SNORT-DEVEL] modification to switch()/case in snprintf.c for NetVI Joel Esler (jesler) (Apr 13)
- Re: [SNORT-DEVEL] modification to switch()/case in snprintf.c for NetVI Russ Combs (rucombs) (Apr 14)
- Re: [SNORT-DEVEL] modification to switch()/case in snprintf.c for NetVI Joshua Kinard (Apr 13)
