]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
freeswitch: Use switch_strlen_zero() to check for empty strings.
authorStefan Knoblich <stkn@openisdn.net>
Tue, 10 Jul 2012 12:47:38 +0000 (14:47 +0200)
committerStefan Knoblich <stkn@openisdn.net>
Wed, 11 Jul 2012 09:08:23 +0000 (11:08 +0200)
Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
src/switch.c

index 30a6f1e7e1054c88c24b7117938e6b8dfe4c8dd0..d4a4e01694ec7a0e64ab6098b8151ef5d0785ea9 100644 (file)
@@ -437,7 +437,7 @@ int main(int argc, char *argv[])
                        if (local_argv[x] && !strcmp(local_argv[x], "-service")) {
                                /* New installs will always have the service name specified, but keep a default for compat */
                                x++;
-                               if (local_argv[x] && strlen(local_argv[x])) {
+                               if (!switch_strlen_zero(local_argv[x])) {
                                        switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN);
                                } else {
                                        switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN);
@@ -450,7 +450,7 @@ int main(int argc, char *argv[])
                                char exePath[1024];
                                char servicePath[1024];
                                x++;
-                               if (local_argv[x] && strlen(local_argv[x])) {
+                               if (!switch_strlen_zero(local_argv[x])) {
                                        switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN);
                                } else {
                                        switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN);
@@ -485,7 +485,7 @@ int main(int argc, char *argv[])
 
                        if (local_argv[x] && !strcmp(local_argv[x], "-uninstall")) {
                                x++;
-                               if (local_argv[x] && strlen(local_argv[x])) {
+                               if (!switch_strlen_zero(local_argv[x])) {
                                        switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN);
                                } else {
                                        switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN);
@@ -521,7 +521,7 @@ int main(int argc, char *argv[])
 #else
                if (local_argv[x] && !strcmp(local_argv[x], "-u")) {
                        x++;
-                       if (local_argv[x] && strlen(local_argv[x])) {
+                       if (!switch_strlen_zero(local_argv[x])) {
                                runas_user = local_argv[x];
                        }
                        known_opt++;
@@ -529,7 +529,7 @@ int main(int argc, char *argv[])
 
                if (local_argv[x] && !strcmp(local_argv[x], "-g")) {
                        x++;
-                       if (local_argv[x] && strlen(local_argv[x])) {
+                       if (!switch_strlen_zero(local_argv[x])) {
                                runas_group = local_argv[x];
                        }
                        known_opt++;
@@ -641,7 +641,7 @@ int main(int argc, char *argv[])
 
                if (local_argv[x] && !strcmp(local_argv[x], "-conf")) {
                        x++;
-                       if (local_argv[x] && strlen(local_argv[x])) {
+                       if (!switch_strlen_zero(local_argv[x])) {
                                SWITCH_GLOBAL_dirs.conf_dir = (char *) malloc(strlen(local_argv[x]) + 1);
                                if (!SWITCH_GLOBAL_dirs.conf_dir) {
                                        fprintf(stderr, "Allocation error\n");
@@ -658,7 +658,7 @@ int main(int argc, char *argv[])
 
                if (local_argv[x] && !strcmp(local_argv[x], "-mod")) {
                        x++;
-                       if (local_argv[x] && strlen(local_argv[x])) {
+                       if (!switch_strlen_zero(local_argv[x])) {
                                SWITCH_GLOBAL_dirs.mod_dir = (char *) malloc(strlen(local_argv[x]) + 1);
                                if (!SWITCH_GLOBAL_dirs.mod_dir) {
                                        fprintf(stderr, "Allocation error\n");
@@ -674,7 +674,7 @@ int main(int argc, char *argv[])
 
                if (local_argv[x] && !strcmp(local_argv[x], "-log")) {
                        x++;
-                       if (local_argv[x] && strlen(local_argv[x])) {
+                       if (!switch_strlen_zero(local_argv[x])) {
                                SWITCH_GLOBAL_dirs.log_dir = (char *) malloc(strlen(local_argv[x]) + 1);
                                if (!SWITCH_GLOBAL_dirs.log_dir) {
                                        fprintf(stderr, "Allocation error\n");
@@ -692,7 +692,7 @@ int main(int argc, char *argv[])
 
                if (local_argv[x] && !strcmp(local_argv[x], "-run")) {
                        x++;
-                       if (local_argv[x] && strlen(local_argv[x])) {
+                       if (!switch_strlen_zero(local_argv[x])) {
                                SWITCH_GLOBAL_dirs.run_dir = (char *) malloc(strlen(local_argv[x]) + 1);
                                if (!SWITCH_GLOBAL_dirs.run_dir) {
                                        fprintf(stderr, "Allocation error\n");
@@ -709,7 +709,7 @@ int main(int argc, char *argv[])
 
                if (local_argv[x] && !strcmp(local_argv[x], "-db")) {
                        x++;
-                       if (local_argv[x] && strlen(local_argv[x])) {
+                       if (!switch_strlen_zero(local_argv[x])) {
                                SWITCH_GLOBAL_dirs.db_dir = (char *) malloc(strlen(local_argv[x]) + 1);
                                if (!SWITCH_GLOBAL_dirs.db_dir) {
                                        fprintf(stderr, "Allocation error\n");
@@ -726,7 +726,7 @@ int main(int argc, char *argv[])
 
                if (local_argv[x] && !strcmp(local_argv[x], "-scripts")) {
                        x++;
-                       if (local_argv[x] && strlen(local_argv[x])) {
+                       if (!switch_strlen_zero(local_argv[x])) {
                                SWITCH_GLOBAL_dirs.script_dir = (char *) malloc(strlen(local_argv[x]) + 1);
                                if (!SWITCH_GLOBAL_dirs.script_dir) {
                                        fprintf(stderr, "Allocation error\n");
@@ -742,7 +742,7 @@ int main(int argc, char *argv[])
 
                if (local_argv[x] && !strcmp(local_argv[x], "-htdocs")) {
                        x++;
-                       if (local_argv[x] && strlen(local_argv[x])) {
+                       if (!switch_strlen_zero(local_argv[x])) {
                                SWITCH_GLOBAL_dirs.htdocs_dir = (char *) malloc(strlen(local_argv[x]) + 1);
                                if (!SWITCH_GLOBAL_dirs.htdocs_dir) {
                                        fprintf(stderr, "Allocation error\n");