[Asterisk-code-review] json.c/strings.c - Add a couple of utility functions (asterisk[master])

Richard Mudgett asteriskteam at digium.com
Fri Feb 8 15:51:17 CST 2019


Richard Mudgett has posted comments on this change. ( https://gerrit.asterisk.org/10981 )

Change subject: json.c/strings.c - Add a couple of utility functions
......................................................................


Patch Set 1:

(1 comment)

https://gerrit.asterisk.org/#/c/10981/1/main/strings.c
File main/strings.c:

https://gerrit.asterisk.org/#/c/10981/1/main/strings.c@253
PS1, Line 253: 	return -2;
Returning -2 is truly weird and unexpected for a compare function.  As a result you couldn't use it with qsort() and expect a sorted array.  This should be 0 as both left and right strings are the same (i.e., NULL).

Another question: Should NULL pointers be considered greater than non-NULL pointers.  You currently sort NULL pointers before non-NULL pointers.  It seems it would be more useful to sort NULL pointers to the end of an array.



-- 
To view, visit https://gerrit.asterisk.org/10981
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I26f0a16d61537505eb41b4b05ef2e6d67fc2541b
Gerrit-Change-Number: 10981
Gerrit-PatchSet: 1
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Friendly Automation (1000185)
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Comment-Date: Fri, 08 Feb 2019 21:51:17 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: No
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190208/a7ca8942/attachment.html>


More information about the asterisk-code-review mailing list