]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
mod_rayo: fix compiler error to nlsml.c from attempted coverity fix
authorChris Rienzo <chris.rienzo@grasshopper.com>
Thu, 8 May 2014 15:10:42 +0000 (11:10 -0400)
committerChris Rienzo <chris.rienzo@grasshopper.com>
Thu, 8 May 2014 15:10:42 +0000 (11:10 -0400)
src/mod/event_handlers/mod_rayo/nlsml.c
src/mod/event_handlers/mod_rayo/test_nlsml/Makefile [new file with mode: 0644]

index 571fae90454612bb57329831be11eeff8b929f70..79f8157e9fb74ed186083aba236b5e6b957192fa 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2013, Grasshopper
+ * Copyright (C) 2013-2014, Grasshopper
  *
  * Version: MPL 1.1
  *
@@ -318,20 +318,20 @@ static int cdata_hook(void *user_data, char *data, size_t len)
 
 /**
  * Parse the result, looking for noinput/nomatch/match
- * @param result the NLSML result to parse
+ * @param nlsml_result the NLSML result to parse
  * @param uuid optional UUID for logging
  * @return true if successful
  */
-enum nlsml_match_type nlsml_parse(const char *result, const char *uuid)
+enum nlsml_match_type nlsml_parse(const char *nlsml_result, const char *uuid)
 {
        struct nlsml_parser parser = { 0 };
        int result = NMT_BAD_XML;
        iksparser *p = NULL;
        parser.uuid = uuid;
 
-       if (!zstr(result)) {
+       if (!zstr(nlsml_result)) {
                p = iks_sax_new(&parser, tag_hook, cdata_hook);
-               if (iks_parse(p, result, 0, 1) == IKS_OK) {
+               if (iks_parse(p, nlsml_result, 0, 1) == IKS_OK) {
                        /* check result */
                        if (parser.match) {
                                result = NMT_MATCH;
@@ -353,8 +353,10 @@ enum nlsml_match_type nlsml_parse(const char *result, const char *uuid)
                switch_log_printf(SWITCH_CHANNEL_UUID_LOG(parser.uuid), SWITCH_LOG_INFO, "Missing NLSML result\n");
        }
  end:
-       if ( p )
+
+       if ( p ) {
                iks_parser_delete(p);
+       }
        return result;
 }
 
diff --git a/src/mod/event_handlers/mod_rayo/test_nlsml/Makefile b/src/mod/event_handlers/mod_rayo/test_nlsml/Makefile
new file mode 100644 (file)
index 0000000..f363f55
--- /dev/null
@@ -0,0 +1,18 @@
+BASE=../../../../..
+
+IKS_DIR=$(BASE)/libs/iksemel
+IKS_LA=$(IKS_DIR)/src/libiksemel.la
+LOCAL_CFLAGS += -I../ -I$(BASE)/libs/iksemel/include
+LOCAL_OBJS= $(PCRE_LA) $(IKS_LA) main.o ../nlsml.o
+LOCAL_SOURCES= main.c
+include $(BASE)/build/modmake.rules
+
+$(IKS_LA): $(IKS_DIR) $(IKS_DIR)/.update
+       @cd $(IKS_DIR) && $(MAKE)
+       @$(TOUCH_TARGET)
+
+local_all:
+       libtool --mode=link gcc main.o ../nlsml.o -o test test_nlsml.la
+
+local_clean:
+       -rm test