[asterisk-dev] Re: trunk r19437 - /trunk/channels/chan_sip.c
Tony Mountifield
tony at softins.clara.co.uk
Wed Apr 12 00:49:17 MST 2006
In article <20060411235436.8A498A948E8 at abita.digium.internal>,
<svn-commits at lists.digium.com> wrote:
> Author: rizzo
> Date: Tue Apr 11 18:54:33 2006
> New Revision: 19437
>
> URL: http://svn.digium.com/view/asterisk?rev=19437&view=rev
> Log:
> remove useless \0, and fix formatting.
>
> Modified:
> trunk/channels/chan_sip.c
>
> Modified: trunk/channels/chan_sip.c
> URL:
> http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=19437&r1=19436&r2=19437&view=diff
> ==============================================================================
> --- trunk/channels/chan_sip.c (original)
> +++ trunk/channels/chan_sip.c Tue Apr 11 18:54:33 2006
> @@ -8882,11 +8882,12 @@
> if (argc != 2) {
> if (argc != 4)
> return RESULT_SHOWUSAGE;
> - else if (strncmp(argv[2], "ip\0", 3) == 0)
> + else if (strncmp(argv[2], "ip", 3) == 0)
> return sip_do_debug_ip(fd, argc, argv);
> - else if (strncmp(argv[2], "peer\0", 5) == 0)
> + else if (strncmp(argv[2], "peer", 5) == 0)
In fact, they don't even need to be strncmp() either. A simple strcmp()
will stop as soon as it gets to the end of one of the strings.
The third parameter to strncmp() above would only take effect if its
value were less than the length of the second parameter.
Cheers
Tony
--
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org
More information about the asterisk-dev
mailing list