summaryrefslogtreecommitdiff
path: root/tests/test_strings.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2015-04-11 15:26:45 +0000
committerMatthew Jordan <mjordan@digium.com>2015-04-11 15:26:45 +0000
commitd0d78d573256ae0b89545c26b5966c9662395395 (patch)
treea37d6f9f93f054a8d5918baf63e918180b4a7bde /tests/test_strings.c
parent4cf7d0bf011069fce2e304d76d59771d89e1401e (diff)
clang compiler warnings: Fix various warnings for tests
This patch fixes a variety of clang compiler warnings for unit tests. This includes autological comparison issues, ignored return values, and interestingly enough, one embedded function. Fun! Review: https://reviewboard.asterisk.org/r/4555 ASTERISK-24917 Reported by: dkdegroot patches: rb4555.patch submitted by dkdegroot (License 6600) ........ Merged revisions 434705 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@434706 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'tests/test_strings.c')
-rw-r--r--tests/test_strings.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/test_strings.c b/tests/test_strings.c
index cf089a865..4321d4a03 100644
--- a/tests/test_strings.c
+++ b/tests/test_strings.c
@@ -390,9 +390,12 @@ AST_TEST_DEFINE(strsep_test)
static int test_semi(char *string1, char *string2, int test_len)
{
char *test2 = NULL;
- if (test_len >= 0) {
+
+ if (test_len > 0) {
test2 = ast_alloca(test_len);
*test2 = '\0';
+ } else if (test_len == 0) {
+ test2 = "";
}
ast_escape_semicolons(string1, test2, test_len);
if (test2 != NULL && strcmp(string2, test2) == 0) {