]> arthur.barton.de Git - netdata.git/commitdiff
reverted strcmp()
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 21 Jan 2017 16:10:25 +0000 (18:10 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 21 Jan 2017 16:10:25 +0000 (18:10 +0200)
33 files changed:
src/adaptive_resortable_list.c
src/adaptive_resortable_list.h
src/appconfig.c
src/apps_plugin.c
src/backends.c
src/dictionary.c
src/eval.c
src/health.c
src/inlined.h
src/log.c
src/main.c
src/plugin_tc.c
src/plugins_d.c
src/proc_diskstats.c
src/proc_net_dev.c
src/proc_net_netstat.c
src/proc_net_rpc_nfs.c
src/proc_net_rpc_nfsd.c
src/proc_net_snmp.c
src/proc_self_mountinfo.c
src/proc_stat.c
src/registry.c
src/registry_internals.c
src/registry_person.c
src/registry_url.c
src/rrd.c
src/rrd2json.c
src/simple_pattern.c
src/sys_fs_cgroup.c
src/web_buffer.c
src/web_buffer_svg.c
src/web_client.c
src/web_server.c

index b6e77cc40fa1936fa424957e0533f7698c09dafe..032d553c3a7c6e61de663f5eb5af798ebf4f3d67 100644 (file)
@@ -130,7 +130,7 @@ int arl_find_or_create_and_relink(ARL_BASE *base, const char *s, const char *val
 
     // find if it already exists in the data
     for(e = base->head; e ; e = e->next)
-        if(e->hash == hash && !strsame(e->name, s))
+        if(e->hash == hash && !strcmp(e->name, s))
             break;
 
 #ifdef NETDATA_INTERNAL_CHECKS
index 23f63e65efcc2e59072bd696a0cf45df793b4408..b338afdaa7c100ecba4660715c0d688ed2418530 100644 (file)
@@ -117,7 +117,7 @@ static inline int arl_check(ARL_BASE *base, const char *keyword, const char *val
     ARL_ENTRY *e = base->next_keyword;
 
     // it should be the first entry (pointed by base->next_keyword)
-    if(likely(!strsame(keyword, e->name))) {
+    if(likely(!strcmp(keyword, e->name))) {
         // it is
 
 #ifdef NETDATA_INTERNAL_CHECKS
index 91583f53a868acf744cab17235037e2bf4d13100..81ab01be2cda7016ad6ffcbe7a9465dec723b42a 100644 (file)
@@ -69,7 +69,7 @@ static inline void config_section_unlock(struct config *co) {
 static int config_value_compare(void* a, void* b) {
     if(((struct config_value *)a)->hash < ((struct config_value *)b)->hash) return -1;
     else if(((struct config_value *)a)->hash > ((struct config_value *)b)->hash) return 1;
-    else return strsame(((struct config_value *)a)->name, ((struct config_value *)b)->name);
+    else return strcmp(((struct config_value *)a)->name, ((struct config_value *)b)->name);
 }
 
 #define config_value_index_add(co, cv) (struct config_value *)avl_insert_lock(&((co)->values_index), (avl *)(cv))
@@ -90,7 +90,7 @@ static struct config_value *config_value_index_find(struct config *co, const cha
 static int config_compare(void* a, void* b) {
     if(((struct config *)a)->hash < ((struct config *)b)->hash) return -1;
     else if(((struct config *)a)->hash > ((struct config *)b)->hash) return 1;
-    else return strsame(((struct config *)a)->name, ((struct config *)b)->name);
+    else return strcmp(((struct config *)a)->name, ((struct config *)b)->name);
 }
 
 avl_tree_lock config_root_index = {
@@ -238,7 +238,7 @@ char *config_get(const char *section, const char *name, const char *default_valu
         // this is a loaded value from the config file
         // if it is different that the default, mark it
         if(!(cv->flags & CONFIG_VALUE_CHECKED)) {
-            if(strsame(cv->value, default_value) != 0) cv->flags |= CONFIG_VALUE_CHANGED;
+            if(strcmp(cv->value, default_value) != 0) cv->flags |= CONFIG_VALUE_CHANGED;
             cv->flags |= CONFIG_VALUE_CHECKED;
         }
     }
@@ -266,7 +266,7 @@ int config_get_boolean(const char *section, const char *name, int value)
     s = config_get(section, name, s);
     if(!s) return value;
 
-    if(!strsame(s, "yes") || !strsame(s, "auto") || !strsame(s, "on demand")) return 1;
+    if(!strcmp(s, "yes") || !strcmp(s, "auto") || !strcmp(s, "on demand")) return 1;
     return 0;
 }
 
@@ -286,11 +286,11 @@ int config_get_boolean_ondemand(const char *section, const char *name, int value
     s = config_get(section, name, s);
     if(!s) return value;
 
-    if(!strsame(s, "yes"))
+    if(!strcmp(s, "yes"))
         return CONFIG_ONDEMAND_YES;
-    else if(!strsame(s, "no"))
+    else if(!strcmp(s, "no"))
         return CONFIG_ONDEMAND_NO;
-    else if(!strsame(s, "auto") || !strsame(s, "on demand"))
+    else if(!strcmp(s, "auto") || !strcmp(s, "on demand"))
         return CONFIG_ONDEMAND_ONDEMAND;
 
     return value;
@@ -313,7 +313,7 @@ const char *config_set_default(const char *section, const char *name, const char
     if(cv->flags & CONFIG_VALUE_LOADED)
         return cv->value;
 
-    if(strsame(cv->value, value) != 0) {
+    if(strcmp(cv->value, value) != 0) {
         cv->flags |= CONFIG_VALUE_CHANGED;
 
         freez(cv->value);
@@ -336,7 +336,7 @@ const char *config_set(const char *section, const char *name, const char *value)
     if(!cv) cv = config_value_create(co, name, value);
     cv->flags |= CONFIG_VALUE_USED;
 
-    if(strsame(cv->value, value) != 0) {
+    if(strcmp(cv->value, value) != 0) {
         cv->flags |= CONFIG_VALUE_CHANGED;
 
         freez(cv->value);
@@ -492,11 +492,11 @@ void generate_config(BUFFER *wb, int only_changed)
 
         config_global_write_lock();
         for(co = config_root; co ; co = co->next) {
-            if(!strsame(co->name, "global") ||
-                    !strsame(co->name, "plugins")  ||
-                    !strsame(co->name, "registry") ||
-                    !strsame(co->name, "health")   ||
-                    !strsame(co->name, "backend"))
+            if(!strcmp(co->name, "global") ||
+                    !strcmp(co->name, "plugins")  ||
+                    !strcmp(co->name, "registry") ||
+                    !strcmp(co->name, "health")   ||
+                    !strcmp(co->name, "backend"))
                 pri = 0;
             else if(!strncmp(co->name, "plugin:", 7)) pri = 1;
             else pri = 2;
index 0aba532b3da81463f8d7a8507973f7b5416cb4ce..d9167b5ae2c0d650a32209dbc211133d7c10fee6 100644 (file)
@@ -218,7 +218,7 @@ static struct target *get_apps_groups_target(const char *id, struct target *targ
             name++;
         }
         for(target = apps_groups_root_target ; target ; target = target->next) {
-            if(!target->target && strsame(name, target->name) == 0)
+            if(!target->target && strcmp(name, target->name) == 0)
                 break;
         }
         if(unlikely(debug)) {
@@ -947,7 +947,7 @@ int file_descriptor_compare(void* a, void* b) {
         return 1;
 
     else
-        return strsame(((struct file_descriptor *)a)->name, ((struct file_descriptor *)b)->name);
+        return strcmp(((struct file_descriptor *)a)->name, ((struct file_descriptor *)b)->name);
 }
 
 int file_descriptor_iterator(avl *a) { if(a) {}; return 0; }
@@ -1122,11 +1122,11 @@ static inline int file_descriptor_find_or_add(const char *name)
     if(name[0] == '/') type = FILETYPE_FILE;
     else if(strncmp(name, "pipe:", 5) == 0) type = FILETYPE_PIPE;
     else if(strncmp(name, "socket:", 7) == 0) type = FILETYPE_SOCKET;
-    else if(strsame(name, "anon_inode:inotify") == 0 || strsame(name, "inotify") == 0) type = FILETYPE_INOTIFY;
-    else if(strsame(name, "anon_inode:[eventfd]") == 0) type = FILETYPE_EVENTFD;
-    else if(strsame(name, "anon_inode:[eventpoll]") == 0) type = FILETYPE_EVENTPOLL;
-    else if(strsame(name, "anon_inode:[timerfd]") == 0) type = FILETYPE_TIMERFD;
-    else if(strsame(name, "anon_inode:[signalfd]") == 0) type = FILETYPE_SIGNALFD;
+    else if(strcmp(name, "anon_inode:inotify") == 0 || strcmp(name, "inotify") == 0) type = FILETYPE_INOTIFY;
+    else if(strcmp(name, "anon_inode:[eventfd]") == 0) type = FILETYPE_EVENTFD;
+    else if(strcmp(name, "anon_inode:[eventpoll]") == 0) type = FILETYPE_EVENTPOLL;
+    else if(strcmp(name, "anon_inode:[timerfd]") == 0) type = FILETYPE_TIMERFD;
+    else if(strcmp(name, "anon_inode:[signalfd]") == 0) type = FILETYPE_SIGNALFD;
     else if(strncmp(name, "anon_inode:", 11) == 0) {
         if(unlikely(debug))
             fprintf(stderr, "apps.plugin: FIXME: unknown anonymous inode: %s\n", name);
@@ -1173,7 +1173,7 @@ static inline int read_pid_file_descriptors(struct pid_stat *p) {
             p->fds[c] = -p->fds[c];
 
         while((de = readdir(fds))) {
-            if(strsame(de->d_name, ".") == 0 || strsame(de->d_name, "..") == 0)
+            if(strcmp(de->d_name, ".") == 0 || strcmp(de->d_name, "..") == 0)
                 continue;
 
             // check if the fds array is small
@@ -1647,9 +1647,9 @@ static inline int collect_data_for_pid(pid_t pid) {
             // 2. the target has the prefix
             // 3. the target has the suffix
             // 4. the target is something inside cmdline
-            if( (!w->starts_with && !w->ends_with && w->comparehash == hash && !strsame(w->compare, p->comm))
+            if( (!w->starts_with && !w->ends_with && w->comparehash == hash && !strcmp(w->compare, p->comm))
                    || (w->starts_with && !w->ends_with && !strncmp(w->compare, p->comm, w->comparelen))
-                   || (!w->starts_with && w->ends_with && pclen >= w->comparelen && !strsame(w->compare, &p->comm[pclen - w->comparelen]))
+                   || (!w->starts_with && w->ends_with && pclen >= w->comparelen && !strcmp(w->compare, &p->comm[pclen - w->comparelen]))
                    || (proc_pid_cmdline_is_needed && w->starts_with && w->ends_with && strstr(p->cmdline, w->compare))
                     ) {
                 if(w->target) p->target = w->target;
@@ -2684,58 +2684,58 @@ static void parse_args(int argc, char **argv)
             }
         }
 
-        if(strsame("version", argv[i]) == 0 || strsame("-v", argv[i]) == 0) {
+        if(strcmp("version", argv[i]) == 0 || strcmp("-v", argv[i]) == 0) {
             printf("apps.plugin %s\n", VERSION);
             exit(0);
         }
 
-        if(strsame("debug", argv[i]) == 0) {
+        if(strcmp("debug", argv[i]) == 0) {
             debug = 1;
             // debug_flags = 0xffffffff;
             continue;
         }
 
-        if(strsame("no-childs", argv[i]) == 0 || strsame("without-childs", argv[i]) == 0) {
+        if(strcmp("no-childs", argv[i]) == 0 || strcmp("without-childs", argv[i]) == 0) {
             include_exited_childs = 0;
             continue;
         }
 
-        if(strsame("with-childs", argv[i]) == 0) {
+        if(strcmp("with-childs", argv[i]) == 0) {
             include_exited_childs = 1;
             continue;
         }
 
-        if(strsame("with-guest", argv[i]) == 0) {
+        if(strcmp("with-guest", argv[i]) == 0) {
             enable_guest_charts = 1;
             continue;
         }
 
-        if(strsame("no-guest", argv[i]) == 0 || strsame("without-guest", argv[i]) == 0) {
+        if(strcmp("no-guest", argv[i]) == 0 || strcmp("without-guest", argv[i]) == 0) {
             enable_guest_charts = 0;
             continue;
         }
 
-        if(strsame("with-files", argv[i]) == 0) {
+        if(strcmp("with-files", argv[i]) == 0) {
             enable_file_charts = 1;
             continue;
         }
 
-        if(strsame("no-files", argv[i]) == 0 || strsame("without-files", argv[i]) == 0) {
+        if(strcmp("no-files", argv[i]) == 0 || strcmp("without-files", argv[i]) == 0) {
             enable_file_charts = 0;
             continue;
         }
 
-        if(strsame("no-users", argv[i]) == 0 || strsame("without-users", argv[i]) == 0) {
+        if(strcmp("no-users", argv[i]) == 0 || strcmp("without-users", argv[i]) == 0) {
             enable_users_charts = 0;
             continue;
         }
 
-        if(strsame("no-groups", argv[i]) == 0 || strsame("without-groups", argv[i]) == 0) {
+        if(strcmp("no-groups", argv[i]) == 0 || strcmp("without-groups", argv[i]) == 0) {
             enable_groups_charts = 0;
             continue;
         }
 
-        if(strsame("-h", argv[i]) == 0 || strsame("--help", argv[i]) == 0) {
+        if(strcmp("-h", argv[i]) == 0 || strcmp("--help", argv[i]) == 0) {
             fprintf(stderr,
                     "apps.plugin %s\n"
                     "(C) 2016 Costa Tsaousis"
index 1d126a201ecf2a227cdb51055a97a44b604be7fd..1272d0473d585d01c38ab77de132025170884dbc 100644 (file)
@@ -169,13 +169,13 @@ void *backends_main(void *ptr) {
     if(!enabled || frequency < 1)
         goto cleanup;
 
-    if(!strsame(source, "as collected")) {
+    if(!strcmp(source, "as collected")) {
         options = BACKEND_SOURCE_DATA_AS_COLLECTED;
     }
-    else if(!strsame(source, "average")) {
+    else if(!strcmp(source, "average")) {
         options = BACKEND_SOURCE_DATA_AVERAGE;
     }
-    else if(!strsame(source, "sum") || !strsame(source, "volume")) {
+    else if(!strcmp(source, "sum") || !strcmp(source, "volume")) {
         options = BACKEND_SOURCE_DATA_SUM;
     }
     else {
@@ -183,7 +183,7 @@ void *backends_main(void *ptr) {
         goto cleanup;
     }
 
-    if(!strsame(type, "graphite") || !strsame(type, "graphite:plaintext")) {
+    if(!strcmp(type, "graphite") || !strcmp(type, "graphite:plaintext")) {
         default_port = 2003;
         if(options == BACKEND_SOURCE_DATA_AS_COLLECTED)
             backend_request_formatter = format_dimension_collected_graphite_plaintext;
@@ -192,7 +192,7 @@ void *backends_main(void *ptr) {
 
         backend_response_checker = process_graphite_response;
     }
-    else if(!strsame(type, "opentsdb") || !strsame(type, "opentsdb:telnet")) {
+    else if(!strcmp(type, "opentsdb") || !strcmp(type, "opentsdb:telnet")) {
         default_port = 4242;
         if(options == BACKEND_SOURCE_DATA_AS_COLLECTED)
             backend_request_formatter = format_dimension_collected_opentsdb_telnet;
index 1466577fef3fa57526859f238cb898ce0af4f2f6..fb9efeedb564258b24c16e5b7f0774fdc278fc23 100644 (file)
@@ -56,7 +56,7 @@ static inline void dictionary_unlock(DICTIONARY *dict) {
 static int name_value_compare(void* a, void* b) {
     if(((NAME_VALUE *)a)->hash < ((NAME_VALUE *)b)->hash) return -1;
     else if(((NAME_VALUE *)a)->hash > ((NAME_VALUE *)b)->hash) return 1;
-    else return strsame(((NAME_VALUE *)a)->name, ((NAME_VALUE *)b)->name);
+    else return strcmp(((NAME_VALUE *)a)->name, ((NAME_VALUE *)b)->name);
 }
 
 static inline NAME_VALUE *dictionary_name_value_index_find_nolock(DICTIONARY *dict, const char *name, uint32_t hash) {
index aeaf9c2bf1c8cf7a3dd554a3fc4ca9ae1becb6a4..122959ce4edb06d6ea99999838e53ec320d1046a 100644 (file)
@@ -77,7 +77,7 @@ static inline calculated_number eval_variable(EVAL_EXPRESSION *exp, EVAL_VARIABL
         critical_hash = simple_hash("CRITICAL");
     }
 
-    if(unlikely(v->hash == this_hash && !strsame(v->name, "this"))) {
+    if(unlikely(v->hash == this_hash && !strcmp(v->name, "this"))) {
         n = (exp->this)?*exp->this:NAN;
         buffer_strcat(exp->error_msg, "[ $this = ");
         print_parsed_as_constant(exp->error_msg, n);
@@ -85,7 +85,7 @@ static inline calculated_number eval_variable(EVAL_EXPRESSION *exp, EVAL_VARIABL
         return n;
     }
 
-    if(unlikely(v->hash == after_hash && !strsame(v->name, "after"))) {
+    if(unlikely(v->hash == after_hash && !strcmp(v->name, "after"))) {
         n = (exp->after && *exp->after)?*exp->after:NAN;
         buffer_strcat(exp->error_msg, "[ $after = ");
         print_parsed_as_constant(exp->error_msg, n);
@@ -93,7 +93,7 @@ static inline calculated_number eval_variable(EVAL_EXPRESSION *exp, EVAL_VARIABL
         return n;
     }
 
-    if(unlikely(v->hash == before_hash && !strsame(v->name, "before"))) {
+    if(unlikely(v->hash == before_hash && !strcmp(v->name, "before"))) {
         n = (exp->before && *exp->before)?*exp->before:NAN;
         buffer_strcat(exp->error_msg, "[ $before = ");
         print_parsed_as_constant(exp->error_msg, n);
@@ -101,7 +101,7 @@ static inline calculated_number eval_variable(EVAL_EXPRESSION *exp, EVAL_VARIABL
         return n;
     }
 
-    if(unlikely(v->hash == now_hash && !strsame(v->name, "now"))) {
+    if(unlikely(v->hash == now_hash && !strcmp(v->name, "now"))) {
         n = now_realtime_sec();
         buffer_strcat(exp->error_msg, "[ $now = ");
         print_parsed_as_constant(exp->error_msg, n);
@@ -109,7 +109,7 @@ static inline calculated_number eval_variable(EVAL_EXPRESSION *exp, EVAL_VARIABL
         return n;
     }
 
-    if(unlikely(v->hash == status_hash && !strsame(v->name, "status"))) {
+    if(unlikely(v->hash == status_hash && !strcmp(v->name, "status"))) {
         n = (exp->status)?*exp->status:RRDCALC_STATUS_UNINITIALIZED;
         buffer_strcat(exp->error_msg, "[ $status = ");
         print_parsed_as_constant(exp->error_msg, n);
@@ -117,7 +117,7 @@ static inline calculated_number eval_variable(EVAL_EXPRESSION *exp, EVAL_VARIABL
         return n;
     }
 
-    if(unlikely(v->hash == removed_hash && !strsame(v->name, "REMOVED"))) {
+    if(unlikely(v->hash == removed_hash && !strcmp(v->name, "REMOVED"))) {
         n = RRDCALC_STATUS_REMOVED;
         buffer_strcat(exp->error_msg, "[ $REMOVED = ");
         print_parsed_as_constant(exp->error_msg, n);
@@ -125,7 +125,7 @@ static inline calculated_number eval_variable(EVAL_EXPRESSION *exp, EVAL_VARIABL
         return n;
     }
 
-    if(unlikely(v->hash == uninitialized_hash && !strsame(v->name, "UNINITIALIZED"))) {
+    if(unlikely(v->hash == uninitialized_hash && !strcmp(v->name, "UNINITIALIZED"))) {
         n = RRDCALC_STATUS_UNINITIALIZED;
         buffer_strcat(exp->error_msg, "[ $UNINITIALIZED = ");
         print_parsed_as_constant(exp->error_msg, n);
@@ -133,7 +133,7 @@ static inline calculated_number eval_variable(EVAL_EXPRESSION *exp, EVAL_VARIABL
         return n;
     }
 
-    if(unlikely(v->hash == undefined_hash && !strsame(v->name, "UNDEFINED"))) {
+    if(unlikely(v->hash == undefined_hash && !strcmp(v->name, "UNDEFINED"))) {
         n = RRDCALC_STATUS_UNDEFINED;
         buffer_strcat(exp->error_msg, "[ $UNDEFINED = ");
         print_parsed_as_constant(exp->error_msg, n);
@@ -141,7 +141,7 @@ static inline calculated_number eval_variable(EVAL_EXPRESSION *exp, EVAL_VARIABL
         return n;
     }
 
-    if(unlikely(v->hash == clear_hash && !strsame(v->name, "CLEAR"))) {
+    if(unlikely(v->hash == clear_hash && !strcmp(v->name, "CLEAR"))) {
         n = RRDCALC_STATUS_CLEAR;
         buffer_strcat(exp->error_msg, "[ $CLEAR = ");
         print_parsed_as_constant(exp->error_msg, n);
@@ -149,7 +149,7 @@ static inline calculated_number eval_variable(EVAL_EXPRESSION *exp, EVAL_VARIABL
         return n;
     }
 
-    if(unlikely(v->hash == warning_hash && !strsame(v->name, "WARNING"))) {
+    if(unlikely(v->hash == warning_hash && !strcmp(v->name, "WARNING"))) {
         n = RRDCALC_STATUS_WARNING;
         buffer_strcat(exp->error_msg, "[ $WARNING = ");
         print_parsed_as_constant(exp->error_msg, n);
@@ -157,7 +157,7 @@ static inline calculated_number eval_variable(EVAL_EXPRESSION *exp, EVAL_VARIABL
         return n;
     }
 
-    if(unlikely(v->hash == critical_hash && !strsame(v->name, "CRITICAL"))) {
+    if(unlikely(v->hash == critical_hash && !strcmp(v->name, "CRITICAL"))) {
         n = RRDCALC_STATUS_CRITICAL;
         buffer_strcat(exp->error_msg, "[ $CRITICAL = ");
         print_parsed_as_constant(exp->error_msg, n);
index 24f6813cd3cfd6697b0e64cba7ce3af8399de0ed..193312eec3af855c2587e15a6dc93d485138b24f 100755 (executable)
@@ -232,7 +232,7 @@ static inline ssize_t health_alarm_log_read(RRDHOST *host, FILE *fp, const char
             }
 
             // check for a possible host missmatch
-            //if(strsame(pointers[1], host->hostname))
+            //if(strcmp(pointers[1], host->hostname))
             //    error("Health: line %zu of file '%s' provides an alarm for host '%s' but this is named '%s'.", line, filename, pointers[1], host->hostname);
 
             ae->unique_id               = unique_id;
@@ -453,7 +453,7 @@ static inline int rrdvar_fix_name(char *variable) {
 int rrdvar_compare(void* a, void* b) {
     if(((RRDVAR *)a)->hash < ((RRDVAR *)b)->hash) return -1;
     else if(((RRDVAR *)a)->hash > ((RRDVAR *)b)->hash) return 1;
-    else return strsame(((RRDVAR *)a)->name, ((RRDVAR *)b)->name);
+    else return strcmp(((RRDVAR *)a)->name, ((RRDVAR *)b)->name);
 }
 
 static inline RRDVAR *rrdvar_index_add(avl_tree_lock *tree, RRDVAR *rv) {
@@ -1100,8 +1100,8 @@ static void rrdsetcalc_link(RRDSET *st, RRDCALC *rc) {
 }
 
 static inline int rrdcalc_is_matching_this_rrdset(RRDCALC *rc, RRDSET *st) {
-    if(     (rc->hash_chart == st->hash      && !strsame(rc->chart, st->id)) ||
-            (rc->hash_chart == st->hash_name && !strsame(rc->chart, st->name)))
+    if(     (rc->hash_chart == st->hash      && !strcmp(rc->chart, st->id)) ||
+            (rc->hash_chart == st->hash_name && !strcmp(rc->chart, st->name)))
         return 1;
 
     return 0;
@@ -1176,7 +1176,7 @@ RRDCALC *rrdcalc_find(RRDSET *st, const char *name) {
     uint32_t hash = simple_hash(name);
 
     for( rc = st->alarms; rc ; rc = rc->rrdset_next ) {
-        if(unlikely(rc->hash == hash && !strsame(rc->name, name)))
+        if(unlikely(rc->hash == hash && !strcmp(rc->name, name)))
             return rc;
     }
 
@@ -1196,7 +1196,7 @@ static inline int rrdcalc_exists(RRDHOST *host, const char *chart, const char *n
 
     // make sure it does not already exist
     for(rc = host->alarms; rc ; rc = rc->next) {
-        if (unlikely(rc->chart && rc->hash == hash_name && rc->hash_chart == hash_chart && !strsame(name, rc->name) && !strsame(chart, rc->chart))) {
+        if (unlikely(rc->chart && rc->hash == hash_name && rc->hash_chart == hash_chart && !strcmp(name, rc->name) && !strcmp(chart, rc->chart))) {
             debug(D_HEALTH, "Health alarm '%s.%s' already exists in host '%s'.", chart, name, host->hostname);
             error("Health alarm '%s.%s' already exists in host '%s'.", chart, name, host->hostname);
             return 1;
@@ -1214,7 +1214,7 @@ static inline uint32_t rrdcalc_get_unique_id(RRDHOST *host, const char *chart, c
         // re-use old IDs, by looking them up in the alarm log
         ALARM_ENTRY *ae;
         for(ae = host->health_log.alarms; ae ;ae = ae->next) {
-            if(unlikely(ae->hash_name == hash_name && ae->hash_chart == hash_chart && !strsame(name, ae->name) && !strsame(chart, ae->chart))) {
+            if(unlikely(ae->hash_name == hash_name && ae->hash_chart == hash_chart && !strcmp(name, ae->name) && !strcmp(chart, ae->chart))) {
                 if(next_event_id) *next_event_id = ae->alarm_event_id + 1;
                 return ae->alarm_id;
             }
@@ -1400,7 +1400,7 @@ void rrdcalctemplate_link_matching(RRDSET *st) {
     RRDCALCTEMPLATE *rt;
 
     for(rt = st->rrdhost->templates; rt ; rt = rt->next) {
-        if(rt->hash_context == st->hash_context && !strsame(rt->context, st->context)
+        if(rt->hash_context == st->hash_context && !strcmp(rt->context, st->context)
                 && (!rt->family_pattern || simple_pattern_matches(rt->family_pattern, st->family))) {
             RRDCALC *rc = rrdcalc_create(st->rrdhost, rt, st->id);
             if(unlikely(!rc))
@@ -1540,7 +1540,7 @@ static inline int rrdcalctemplate_add_template_from_config(RRDHOST *host, RRDCAL
 
     RRDCALCTEMPLATE *t, *last = NULL;
     for (t = host->templates; t ; last = t, t = t->next) {
-        if(unlikely(t->hash_name == rt->hash_name && !strsame(t->name, rt->name))) {
+        if(unlikely(t->hash_name == rt->hash_name && !strcmp(t->name, rt->name))) {
             error("Health configuration template '%s' already exists for host '%s'.", rt->name, host->hostname);
             return 0;
         }
@@ -1955,7 +1955,7 @@ int health_readfile(const char *path, const char *filename) {
         else if(rc) {
             if(hash == hash_on && !strcasecmp(key, HEALTH_ON_KEY)) {
                 if(rc->chart) {
-                    if(strsame(rc->chart, value))
+                    if(strcmp(rc->chart, value))
                         error("Health configuration at line %zu of file '%s/%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
                                 line, path, filename, rc->name, key, rc->chart, value, value);
 
@@ -2019,7 +2019,7 @@ int health_readfile(const char *path, const char *filename) {
             }
             else if(hash == hash_exec && !strcasecmp(key, HEALTH_EXEC_KEY)) {
                 if(rc->exec) {
-                    if(strsame(rc->exec, value))
+                    if(strcmp(rc->exec, value))
                         error("Health configuration at line %zu of file '%s/%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
                              line, path, filename, rc->name, key, rc->exec, value, value);
 
@@ -2029,7 +2029,7 @@ int health_readfile(const char *path, const char *filename) {
             }
             else if(hash == hash_recipient && !strcasecmp(key, HEALTH_RECIPIENT_KEY)) {
                 if(rc->recipient) {
-                    if(strsame(rc->recipient, value))
+                    if(strcmp(rc->recipient, value))
                         error("Health configuration at line %zu of file '%s/%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
                              line, path, filename, rc->name, key, rc->recipient, value, value);
 
@@ -2039,7 +2039,7 @@ int health_readfile(const char *path, const char *filename) {
             }
             else if(hash == hash_units && !strcasecmp(key, HEALTH_UNITS_KEY)) {
                 if(rc->units) {
-                    if(strsame(rc->units, value))
+                    if(strcmp(rc->units, value))
                         error("Health configuration at line %zu of file '%s/%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
                              line, path, filename, rc->name, key, rc->units, value, value);
 
@@ -2050,7 +2050,7 @@ int health_readfile(const char *path, const char *filename) {
             }
             else if(hash == hash_info && !strcasecmp(key, HEALTH_INFO_KEY)) {
                 if(rc->info) {
-                    if(strsame(rc->info, value))
+                    if(strcmp(rc->info, value))
                         error("Health configuration at line %zu of file '%s/%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
                              line, path, filename, rc->name, key, rc->info, value, value);
 
@@ -2070,7 +2070,7 @@ int health_readfile(const char *path, const char *filename) {
         else if(rt) {
             if(hash == hash_on && !strcasecmp(key, HEALTH_ON_KEY)) {
                 if(rt->context) {
-                    if(strsame(rt->context, value))
+                    if(strcmp(rt->context, value))
                         error("Health configuration at line %zu of file '%s/%s' for template '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
                                 line, path, filename, rt->name, key, rt->context, value, value);
 
@@ -2140,7 +2140,7 @@ int health_readfile(const char *path, const char *filename) {
             }
             else if(hash == hash_exec && !strcasecmp(key, HEALTH_EXEC_KEY)) {
                 if(rt->exec) {
-                    if(strsame(rt->exec, value))
+                    if(strcmp(rt->exec, value))
                         error("Health configuration at line %zu of file '%s/%s' for template '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
                              line, path, filename, rt->name, key, rt->exec, value, value);
 
@@ -2150,7 +2150,7 @@ int health_readfile(const char *path, const char *filename) {
             }
             else if(hash == hash_recipient && !strcasecmp(key, HEALTH_RECIPIENT_KEY)) {
                 if(rt->recipient) {
-                    if(strsame(rt->recipient, value))
+                    if(strcmp(rt->recipient, value))
                         error("Health configuration at line %zu of file '%s/%s' for template '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
                              line, path, filename, rt->name, key, rt->recipient, value, value);
 
@@ -2160,7 +2160,7 @@ int health_readfile(const char *path, const char *filename) {
             }
             else if(hash == hash_units && !strcasecmp(key, HEALTH_UNITS_KEY)) {
                 if(rt->units) {
-                    if(strsame(rt->units, value))
+                    if(strcmp(rt->units, value))
                         error("Health configuration at line %zu of file '%s/%s' for template '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
                              line, path, filename, rt->name, key, rt->units, value, value);
 
@@ -2171,7 +2171,7 @@ int health_readfile(const char *path, const char *filename) {
             }
             else if(hash == hash_info && !strcasecmp(key, HEALTH_INFO_KEY)) {
                 if(rt->info) {
-                    if(strsame(rt->info, value))
+                    if(strcmp(rt->info, value))
                         error("Health configuration at line %zu of file '%s/%s' for template '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
                              line, path, filename, rt->name, key, rt->info, value, value);
 
@@ -2239,7 +2239,7 @@ void health_readdir(const char *path) {
         }
 
         else if((de->d_type == DT_LNK || de->d_type == DT_REG || de->d_type == DT_UNKNOWN) &&
-                len > 5 && !strsame(&de->d_name[len - 5], ".conf")) {
+                len > 5 && !strcmp(&de->d_name[len - 5], ".conf")) {
             health_readfile(path, de->d_name);
         }
 
index 65e6db24fd864fbda3ae5504a0bef689ca4e62d5..5351ee27c72cdb273adbd5afc5b12eb0024255d3 100644 (file)
@@ -27,6 +27,19 @@ static inline uint32_t simple_uhash(const char *name) {
     return hval;
 }
 
+static inline int simple_hash_strcmp(const char *name, const char *b, uint32_t *hash) {
+    unsigned char *s = (unsigned char *) name;
+    uint32_t hval = 0x811c9dc5;
+    int ret = 0;
+    while (*s) {
+        if(!ret) ret = *s - *b++;
+        hval *= 16777619;
+        hval ^= (uint32_t) *s++;
+    }
+    *hash = hval;
+    return ret;
+}
+
 static inline int str2i(const char *s) {
     int n = 0;
     char c, negative = (*s == '-');
@@ -77,14 +90,12 @@ static inline unsigned long long str2ull(const char *s) {
     return n;
 }
 
-#ifdef NETDATA_STRSAME
-static inline int strsame(const char *a, const char *b) {
+#ifdef NETDATA_STRCMP_OVERRIDE
+static inline int strcmp(const char *a, const char *b) {
     if(unlikely(a == b)) return 0;
     while(*a && *a == *b) { a++; b++; }
     return *a - *b;
 }
-#else
-#define strsame(a, b) strcmp(a, b)
 #endif // NETDATA_STRSAME
 
 static inline int read_single_number_file(const char *filename, unsigned long long *result) {
index e96fa1395db7226f7cd13e3cf270e6118943831d..d4c7fa14d904a6ee9007863e03f6ef73418ae0b9 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -26,10 +26,10 @@ void syslog_init(void) {
 int open_log_file(int fd, FILE **fp, const char *filename, int *enabled_syslog) {
     int f;
 
-    if(!filename || !*filename || !strsame(filename, "none"))
+    if(!filename || !*filename || !strcmp(filename, "none"))
         filename = "/dev/null";
 
-    if(!strsame(filename, "syslog")) {
+    if(!strcmp(filename, "syslog")) {
         filename = "/dev/null";
         syslog_init();
         if(enabled_syslog) *enabled_syslog = 1;
@@ -38,15 +38,15 @@ int open_log_file(int fd, FILE **fp, const char *filename, int *enabled_syslog)
 
     // don't do anything if the user is willing
     // to have the standard one
-    if(!strsame(filename, "system")) {
+    if(!strcmp(filename, "system")) {
         if(fd != -1) return fd;
         filename = "stdout";
     }
 
-    if(!strsame(filename, "stdout"))
+    if(!strcmp(filename, "stdout"))
         f = STDOUT_FILENO;
 
-    else if(!strsame(filename, "stderr"))
+    else if(!strcmp(filename, "stderr"))
         f = STDERR_FILENO;
 
     else {
index fdedb08129ce9e0a3253e0be1390cc7532e07498..36c022f8cdec4bbb926bd7860884c5389761f31a 100644 (file)
@@ -77,15 +77,15 @@ void web_server_threading_selection(void) {
     web_enable_gzip = config_get_boolean("global", "enable web responses gzip compression", web_enable_gzip);
 
     char *s = config_get("global", "web compression strategy", "default");
-    if(!strsame(s, "default"))
+    if(!strcmp(s, "default"))
         web_gzip_strategy = Z_DEFAULT_STRATEGY;
-    else if(!strsame(s, "filtered"))
+    else if(!strcmp(s, "filtered"))
         web_gzip_strategy = Z_FILTERED;
-    else if(!strsame(s, "huffman only"))
+    else if(!strcmp(s, "huffman only"))
         web_gzip_strategy = Z_HUFFMAN_ONLY;
-    else if(!strsame(s, "rle"))
+    else if(!strcmp(s, "rle"))
         web_gzip_strategy = Z_RLE;
-    else if(!strsame(s, "fixed"))
+    else if(!strcmp(s, "fixed"))
         web_gzip_strategy = Z_FIXED;
     else {
         error("Invalid compression strategy '%s'. Valid strategies are 'default', 'filtered', 'huffman only', 'rle' and 'fixed'. Proceeding with 'default'.", s);
@@ -351,22 +351,22 @@ int main(int argc, char **argv)
     {
         i = 1;
         while(i < argc) {
-            if(strsame(argv[i], "-pidfile") == 0 && (i+1) < argc) {
+            if(strcmp(argv[i], "-pidfile") == 0 && (i+1) < argc) {
                 strncpyz(pidfile, argv[i+1], FILENAME_MAX);
                 fprintf(stderr, "%s: deprecated option -- %s -- please use -P instead.\n", argv[0], argv[i]);
                 remove_option(i, &argc, argv);
             }
-            else if(strsame(argv[i], "-nodaemon") == 0 || strsame(argv[i], "-nd") == 0) {
+            else if(strcmp(argv[i], "-nodaemon") == 0 || strcmp(argv[i], "-nd") == 0) {
                 dont_fork = 1;
                 fprintf(stderr, "%s: deprecated option -- %s -- please use -D instead.\n ", argv[0], argv[i]);
                 remove_option(i, &argc, argv);
             }
-            else if(strsame(argv[i], "-ch") == 0 && (i+1) < argc) {
+            else if(strcmp(argv[i], "-ch") == 0 && (i+1) < argc) {
                 config_set("global", "host access prefix", argv[i+1]);
                 fprintf(stderr, "%s: deprecated option -- %s -- please use -s instead.\n", argv[0], argv[i]);
                 remove_option(i, &argc, argv);
             }
-            else if(strsame(argv[i], "-l") == 0 && (i+1) < argc) {
+            else if(strcmp(argv[i], "-l") == 0 && (i+1) < argc) {
                 config_set("global", "history", argv[i+1]);
                 fprintf(stderr, "%s: deprecated option -- %s -- This option will be removed with V2.*.\n", argv[0], argv[i]);
                 remove_option(i, &argc, argv);
@@ -443,14 +443,14 @@ int main(int argc, char **argv)
                     {
                         char* stacksize_string = "stacksize=";
                         char* debug_flags_string = "debug_flags=";
-                        if(strsame(optarg, "unittest") == 0) {
+                        if(strcmp(optarg, "unittest") == 0) {
                             rrd_update_every = 1;
                             if(run_all_mockup_tests()) exit(1);
                             if(unit_test_storage()) exit(1);
                             fprintf(stderr, "\n\nALL TESTS PASSED\n\n");
                             exit(0);
                         }
-                        else if(strsame(optarg, "simple-pattern") == 0) {
+                        else if(strcmp(optarg, "simple-pattern") == 0) {
                             if(optind + 2 > argc) {
                                 fprintf(stderr, "%s", "\nUSAGE: -W simple-pattern 'pattern' 'string'\n\n"
                                         " Checks if 'pattern' matches the given 'string'.\n"
index 2d133db7e465d6b8f84351cfc894ea3f9e542f02..0fa5953207c8d60af0c12bbd5e6e1fa812c929f9 100644 (file)
@@ -92,7 +92,7 @@ struct tc_device *tc_device_root = NULL;
 static int tc_device_compare(void* a, void* b) {
     if(((struct tc_device *)a)->hash < ((struct tc_device *)b)->hash) return -1;
     else if(((struct tc_device *)a)->hash > ((struct tc_device *)b)->hash) return 1;
-    else return strsame(((struct tc_device *)a)->id, ((struct tc_device *)b)->id);
+    else return strcmp(((struct tc_device *)a)->id, ((struct tc_device *)b)->id);
 }
 
 avl_tree tc_device_root_index = {
@@ -118,7 +118,7 @@ static inline struct tc_device *tc_device_index_find(const char *id, uint32_t ha
 static int tc_class_compare(void* a, void* b) {
     if(((struct tc_class *)a)->hash < ((struct tc_class *)b)->hash) return -1;
     else if(((struct tc_class *)a)->hash > ((struct tc_class *)b)->hash) return 1;
-    else return strsame(((struct tc_class *)a)->id, ((struct tc_class *)b)->id);
+    else return strcmp(((struct tc_class *)a)->id, ((struct tc_class *)b)->id);
 }
 
 #define tc_class_index_add(st, rd) (struct tc_class *)avl_insert(&((st)->classes_index), (avl *)(rd))
@@ -221,8 +221,8 @@ static inline void tc_device_commit(struct tc_device *d) {
             if(unlikely(c == x)) continue;
 
             if(x->parentid && (
-                (               c->hash      == x->parent_hash && strsame(c->id,     x->parentid) == 0) ||
-                (c->leafid   && c->leaf_hash == x->parent_hash && strsame(c->leafid, x->parentid) == 0))) {
+                (               c->hash      == x->parent_hash && strcmp(c->id,     x->parentid) == 0) ||
+                (c->leafid   && c->leaf_hash == x->parent_hash && strcmp(c->leafid, x->parentid) == 0))) {
                 // debug(D_TC_LOOP, "TC: In device '%s', class '%s' (leafid: '%s') has as leaf class '%s' (parentid: '%s').", d->name?d->name:d->id, c->name?c->name:c->id, c->leafid?c->leafid:c->id, x->name?x->name:x->id, x->parentid?x->parentid:x->id);
                 c->isleaf = 0;
                 x->hasparent = 1;
@@ -314,7 +314,7 @@ static inline void tc_device_commit(struct tc_device *d) {
                 debug(D_TC_LOOP, "TC: Updating chart for device '%s'", d->name?d->name:d->id);
                 rrdset_next(d->st_bytes);
 
-                if(unlikely(d->name_updated && d->name && strsame(d->id, d->name) != 0)) {
+                if(unlikely(d->name_updated && d->name && strcmp(d->id, d->name) != 0)) {
                     rrdset_set_name(d->st_bytes, d->name);
                     d->name_updated = 0;
                 }
@@ -341,7 +341,7 @@ static inline void tc_device_commit(struct tc_device *d) {
                     rrddim_set_by_pointer(d->st_bytes, c->rd_bytes, c->bytes);
 
                     // if it has a name, different to the id
-                    if(unlikely(c->name_updated && c->name && strsame(c->id, c->name) != 0)) {
+                    if(unlikely(c->name_updated && c->name && strcmp(c->id, c->name) != 0)) {
                         // update the rrd dimension with the new name
                         debug(D_TC_LOOP, "TC: Setting chart '%s', dimension '%s' name to '%s'", d->st_bytes->id, c->rd_bytes->id, c->name);
                         rrddim_set_name(d->st_bytes, c->rd_bytes, c->name);
@@ -395,7 +395,7 @@ static inline void tc_device_commit(struct tc_device *d) {
                     rrddim_set_by_pointer(d->st_packets, c->rd_packets, c->packets);
 
                     // if it has a name, different to the id
-                    if(unlikely(c->name_updated && c->name && strsame(c->id, c->name) != 0)) {
+                    if(unlikely(c->name_updated && c->name && strcmp(c->id, c->name) != 0)) {
                         // update the rrd dimension with the new name
                         debug(D_TC_LOOP, "TC: Setting chart '%s', dimension '%s' name to '%s'", d->st_packets->id, c->rd_packets->id, c->name);
                         rrddim_set_name(d->st_packets, c->rd_packets, c->name);
@@ -449,7 +449,7 @@ static inline void tc_device_commit(struct tc_device *d) {
                     rrddim_set_by_pointer(d->st_dropped, c->rd_dropped, c->dropped);
 
                     // if it has a name, different to the id
-                    if(unlikely(c->name_updated && c->name && strsame(c->id, c->name) != 0)) {
+                    if(unlikely(c->name_updated && c->name && strcmp(c->id, c->name) != 0)) {
                         // update the rrd dimension with the new name
                         debug(D_TC_LOOP, "TC: Setting chart '%s', dimension '%s' name to '%s'", d->st_dropped->id, c->rd_dropped->id, c->name);
                         rrddim_set_name(d->st_dropped, c->rd_dropped, c->name);
@@ -503,7 +503,7 @@ static inline void tc_device_commit(struct tc_device *d) {
                     rrddim_set_by_pointer(d->st_tokens, c->rd_tokens, c->tokens);
 
                     // if it has a name, different to the id
-                    if(unlikely(c->name_updated && c->name && strsame(c->id, c->name) != 0)) {
+                    if(unlikely(c->name_updated && c->name && strcmp(c->id, c->name) != 0)) {
                         // update the rrd dimension with the new name
                         debug(D_TC_LOOP, "TC: Setting chart '%s', dimension '%s' name to '%s'", d->st_tokens->id, c->rd_tokens->id, c->name);
                         rrddim_set_name(d->st_tokens, c->rd_tokens, c->name);
@@ -557,7 +557,7 @@ static inline void tc_device_commit(struct tc_device *d) {
                     rrddim_set_by_pointer(d->st_ctokens, c->rd_ctokens, c->ctokens);
 
                     // if it has a name, different to the id
-                    if(unlikely(c->name_updated && c->name && strsame(c->id, c->name) != 0)) {
+                    if(unlikely(c->name_updated && c->name && strcmp(c->id, c->name) != 0)) {
                         // update the rrd dimension with the new name
                         debug(D_TC_LOOP, "TC: Setting chart '%s', dimension '%s' name to '%s'", d->st_ctokens->id, c->rd_ctokens->id, c->name);
                         rrddim_set_name(d->st_ctokens, c->rd_ctokens, c->name);
@@ -578,7 +578,7 @@ static inline void tc_device_set_class_name(struct tc_device *d, char *id, char
         freez(c->name);
         c->name = NULL;
 
-        if(likely(name && *name && strsame(c->id, name) != 0)) {
+        if(likely(name && *name && strcmp(c->id, name) != 0)) {
             debug(D_TC_LOOP, "TC: Setting device '%s', class '%s' name to '%s'", d->id, id, name);
             c->name = strdupz(name);
             c->name_updated = 1;
@@ -590,7 +590,7 @@ static inline void tc_device_set_device_name(struct tc_device *d, char *name) {
     freez(d->name);
     d->name = NULL;
 
-    if(likely(name && *name && strsame(d->id, name) != 0)) {
+    if(likely(name && *name && strcmp(d->id, name) != 0)) {
         debug(D_TC_LOOP, "TC: Setting device '%s' name to '%s'", d->id, name);
         d->name = strdupz(name);
         d->name_updated = 1;
@@ -601,7 +601,7 @@ static inline void tc_device_set_device_family(struct tc_device *d, char *family
     freez(d->family);
     d->family = NULL;
 
-    if(likely(family && *family && strsame(d->id, family) != 0)) {
+    if(likely(family && *family && strcmp(d->id, family) != 0)) {
         debug(D_TC_LOOP, "TC: Setting device '%s' family to '%s'", d->id, family);
         d->family = strdupz(family);
         d->family_updated = 1;
@@ -815,17 +815,17 @@ void *tc_main(void *ptr) {
 
             first_hash = simple_hash(words[0]);
 
-            if(unlikely(device && first_hash == CLASS_HASH && strsame(words[0], "class") == 0)) {
+            if(unlikely(device && first_hash == CLASS_HASH && strcmp(words[0], "class") == 0)) {
                 // debug(D_TC_LOOP, "CLASS line on class id='%s', parent='%s', parentid='%s', leaf='%s', leafid='%s'", words[2], words[3], words[4], words[5], words[6]);
 
                 // words[1] : class type
                 // words[2] : N:XX
                 // words[3] : parent or root
-                if(likely(words[1] && words[2] && words[3] && (strsame(words[3], "parent") == 0 || strsame(words[3], "root") == 0))) {
+                if(likely(words[1] && words[2] && words[3] && (strcmp(words[3], "parent") == 0 || strcmp(words[3], "root") == 0))) {
                     //char *type     = words[1];  // the class: htb, fq_codel, etc
 
                     // we are only interested for HTB classes
-                    //if(strsame(type, "htb") != 0) continue;
+                    //if(strcmp(type, "htb") != 0) continue;
 
                     char *id       = words[2];  // the class major:minor
                     char *parent   = words[3];  // 'parent' or 'root'
@@ -833,11 +833,11 @@ void *tc_main(void *ptr) {
                     char *leaf     = words[5];  // 'leaf'
                     char *leafid   = words[6];  // leafid
 
-                    if(strsame(parent, "root") == 0) {
+                    if(strcmp(parent, "root") == 0) {
                         parentid = NULL;
                         leafid = NULL;
                     }
-                    else if(!leaf || strsame(leaf, "leaf") != 0)
+                    else if(!leaf || strcmp(leaf, "leaf") != 0)
                         leafid = NULL;
 
                     char leafbuf[20 + 1] = "";
@@ -854,7 +854,7 @@ void *tc_main(void *ptr) {
                     class = NULL;
                 }
             }
-            else if(unlikely(first_hash == END_HASH && strsame(words[0], "END") == 0)) {
+            else if(unlikely(first_hash == END_HASH && strcmp(words[0], "END") == 0)) {
                 // debug(D_TC_LOOP, "END line");
 
                 if(likely(device)) {
@@ -871,7 +871,7 @@ void *tc_main(void *ptr) {
                 device = NULL;
                 class = NULL;
             }
-            else if(unlikely(first_hash == BEGIN_HASH && strsame(words[0], "BEGIN") == 0)) {
+            else if(unlikely(first_hash == BEGIN_HASH && strcmp(words[0], "BEGIN") == 0)) {
                 // debug(D_TC_LOOP, "BEGIN line on device '%s'", words[1]);
 
                 if(likely(words[1] && *words[1])) {
@@ -884,7 +884,7 @@ void *tc_main(void *ptr) {
 
                 class = NULL;
             }
-            else if(unlikely(device && class && first_hash == SENT_HASH && strsame(words[0], "Sent") == 0)) {
+            else if(unlikely(device && class && first_hash == SENT_HASH && strcmp(words[0], "Sent") == 0)) {
                 // debug(D_TC_LOOP, "SENT line '%s'", words[1]);
                 if(likely(words[1] && *words[1])) {
                     class->bytes = str2ull(words[1]);
@@ -906,7 +906,7 @@ void *tc_main(void *ptr) {
                 if(likely(words[10] && *words[10]))
                     class->requeues = str2ull(words[8]);
             }
-            else if(unlikely(device && class && class->updated && first_hash == LENDED_HASH && strsame(words[0], "lended:") == 0)) {
+            else if(unlikely(device && class && class->updated && first_hash == LENDED_HASH && strcmp(words[0], "lended:") == 0)) {
                 // debug(D_TC_LOOP, "LENDED line '%s'", words[1]);
                 if(likely(words[1] && *words[1]))
                     class->lended = str2ull(words[1]);
@@ -917,7 +917,7 @@ void *tc_main(void *ptr) {
                 if(likely(words[5] && *words[5]))
                     class->giants = str2ull(words[5]);
             }
-            else if(unlikely(device && class && class->updated && first_hash == TOKENS_HASH && strsame(words[0], "tokens:") == 0)) {
+            else if(unlikely(device && class && class->updated && first_hash == TOKENS_HASH && strcmp(words[0], "tokens:") == 0)) {
                 // debug(D_TC_LOOP, "TOKENS line '%s'", words[1]);
                 if(likely(words[1] && *words[1]))
                     class->tokens = str2ull(words[1]);
@@ -925,24 +925,24 @@ void *tc_main(void *ptr) {
                 if(likely(words[3] && *words[3]))
                     class->ctokens = str2ull(words[3]);
             }
-            else if(unlikely(device && first_hash == SETDEVICENAME_HASH && strsame(words[0], "SETDEVICENAME") == 0)) {
+            else if(unlikely(device && first_hash == SETDEVICENAME_HASH && strcmp(words[0], "SETDEVICENAME") == 0)) {
                 // debug(D_TC_LOOP, "SETDEVICENAME line '%s'", words[1]);
                 if(likely(words[1] && *words[1]))
                     tc_device_set_device_name(device, words[1]);
             }
-            else if(unlikely(device && first_hash == SETDEVICEGROUP_HASH && strsame(words[0], "SETDEVICEGROUP") == 0)) {
+            else if(unlikely(device && first_hash == SETDEVICEGROUP_HASH && strcmp(words[0], "SETDEVICEGROUP") == 0)) {
                 // debug(D_TC_LOOP, "SETDEVICEGROUP line '%s'", words[1]);
                 if(likely(words[1] && *words[1]))
                     tc_device_set_device_family(device, words[1]);
             }
-            else if(unlikely(device && first_hash == SETCLASSNAME_HASH && strsame(words[0], "SETCLASSNAME") == 0)) {
+            else if(unlikely(device && first_hash == SETCLASSNAME_HASH && strcmp(words[0], "SETCLASSNAME") == 0)) {
                 // debug(D_TC_LOOP, "SETCLASSNAME line '%s' '%s'", words[1], words[2]);
                 char *id    = words[1];
                 char *path  = words[2];
                 if(likely(id && *id && path && *path))
                     tc_device_set_class_name(device, id, path);
             }
-            else if(unlikely(first_hash == WORKTIME_HASH && strsame(words[0], "WORKTIME") == 0)) {
+            else if(unlikely(first_hash == WORKTIME_HASH && strcmp(words[0], "WORKTIME") == 0)) {
                 // debug(D_TC_LOOP, "WORKTIME line '%s' '%s'", words[1], words[2]);
                 getrusage(RUSAGE_THREAD, &thread);
 
@@ -970,7 +970,7 @@ void *tc_main(void *ptr) {
 
             }
 #ifdef DETACH_PLUGINS_FROM_NETDATA
-            else if(unlikely(first_hash == MYPID_HASH && (strsame(words[0], "MYPID") == 0))) {
+            else if(unlikely(first_hash == MYPID_HASH && (strcmp(words[0], "MYPID") == 0))) {
                 // debug(D_TC_LOOP, "MYPID line '%s'", words[1]);
                 char *id = words[1];
                 pid_t pid = atol(id);
index 7fe46e46f18feac90a817975cd807334885f401e..276f92e1d955c2d9675172bbb9a363cde0f8e7c3 100644 (file)
@@ -97,7 +97,6 @@ void *pluginsd_worker_thread(void *arg)
 #endif
 
     char *words[MAX_WORDS] = { NULL };
-    uint32_t SET_HASH = simple_hash("SET");
     uint32_t BEGIN_HASH = simple_hash("BEGIN");
     uint32_t END_HASH = simple_hash("END");
     uint32_t FLUSH_HASH = simple_hash("FLUSH");
@@ -141,9 +140,7 @@ void *pluginsd_worker_thread(void *arg)
 
             // debug(D_PLUGINSD, "PLUGINSD: words 0='%s' 1='%s' 2='%s' 3='%s' 4='%s' 5='%s' 6='%s' 7='%s' 8='%s' 9='%s'", words[0], words[1], words[2], words[3], words[4], words[5], words[6], words[7], words[8], words[9]);
 
-            hash = simple_hash(s);
-
-            if(likely(hash == SET_HASH && !strsame(s, "SET"))) {
+            if(likely(!simple_hash_strcmp(s, "SET", &hash))) {
                 char *dimension = words[1];
                 char *value = words[2];
 
@@ -167,7 +164,7 @@ void *pluginsd_worker_thread(void *arg)
 
                 if(value) rrddim_set(st, dimension, strtoll(value, NULL, 0));
             }
-            else if(likely(hash == BEGIN_HASH && !strsame(s, "BEGIN"))) {
+            else if(likely(hash == BEGIN_HASH && !strcmp(s, "BEGIN"))) {
                 char *id = words[1];
                 char *microseconds_txt = words[2];
 
@@ -193,7 +190,7 @@ void *pluginsd_worker_thread(void *arg)
                     else rrdset_next(st);
                 }
             }
-            else if(likely(hash == END_HASH && !strsame(s, "END"))) {
+            else if(likely(hash == END_HASH && !strcmp(s, "END"))) {
                 if(unlikely(!st)) {
                     error("PLUGINSD: '%s' is requesting an END, without a BEGIN. Disabling it.", cd->fullfilename);
                     cd->enabled = 0;
@@ -208,15 +205,15 @@ void *pluginsd_worker_thread(void *arg)
 
                 count++;
             }
-            else if(likely(hash == FLUSH_HASH && !strsame(s, "FLUSH"))) {
+            else if(likely(hash == FLUSH_HASH && !strcmp(s, "FLUSH"))) {
                 debug(D_PLUGINSD, "PLUGINSD: '%s' is requesting a FLUSH", cd->fullfilename);
                 st = NULL;
             }
-            else if(likely(hash == CHART_HASH && !strsame(s, "CHART"))) {
+            else if(likely(hash == CHART_HASH && !strcmp(s, "CHART"))) {
                 int noname = 0;
                 st = NULL;
 
-                if((words[1]) != NULL && (words[2]) != NULL && strsame(words[1], words[2]) == 0)
+                if((words[1]) != NULL && (words[2]) != NULL && strcmp(words[1], words[2]) == 0)
                     noname = 1;
 
                 char *type = words[1];
@@ -272,7 +269,7 @@ void *pluginsd_worker_thread(void *arg)
                 }
                 else debug(D_PLUGINSD, "PLUGINSD: Chart '%s' already exists. Not adding it again.", st->id);
             }
-            else if(likely(hash == DIMENSION_HASH && !strsame(s, "DIMENSION"))) {
+            else if(likely(hash == DIMENSION_HASH && !strcmp(s, "DIMENSION"))) {
                 char *id = words[1];
                 char *name = words[2];
                 char *algorithm = words[3];
@@ -326,21 +323,21 @@ void *pluginsd_worker_thread(void *arg)
                 }
                 else if(unlikely(st->debug)) debug(D_PLUGINSD, "PLUGINSD: dimension %s/%s already exists. Not adding it again.", st->id, id);
             }
-            else if(unlikely(hash == DISABLE_HASH && !strsame(s, "DISABLE"))) {
+            else if(unlikely(hash == DISABLE_HASH && !strcmp(s, "DISABLE"))) {
                 info("PLUGINSD: '%s' called DISABLE. Disabling it.", cd->fullfilename);
                 cd->enabled = 0;
                 killpid(cd->pid, SIGTERM);
                 break;
             }
 #ifdef DETACH_PLUGINS_FROM_NETDATA
-            else if(likely(hash == MYPID_HASH && !strsame(s, "MYPID"))) {
+            else if(likely(hash == MYPID_HASH && !strcmp(s, "MYPID"))) {
                 char *pid_s = words[1];
                 pid_t pid = strtod(pid_s, NULL, 0);
 
                 if(likely(pid)) cd->pid = pid;
                 debug(D_PLUGINSD, "PLUGINSD: %s is on pid %d", cd->id, cd->pid);
             }
-            else if(likely(hash == STOPPING_WAKE_ME_UP_PLEASE_HASH && !strsame(s, "STOPPING_WAKE_ME_UP_PLEASE"))) {
+            else if(likely(hash == STOPPING_WAKE_ME_UP_PLEASE_HASH && !strcmp(s, "STOPPING_WAKE_ME_UP_PLEASE"))) {
                 error("PLUGINSD: '%s' (pid %d) called STOPPING_WAKE_ME_UP_PLEASE.", cd->fullfilename, cd->pid);
 
                 now_realtime_timeval(&now);
@@ -472,11 +469,11 @@ void *pluginsd_main(void *ptr) {
 
             debug(D_PLUGINSD, "PLUGINSD: Examining file '%s'", file->d_name);
 
-            if(unlikely(strsame(file->d_name, ".") == 0 || strsame(file->d_name, "..") == 0)) continue;
+            if(unlikely(strcmp(file->d_name, ".") == 0 || strcmp(file->d_name, "..") == 0)) continue;
 
             int len = (int) strlen(file->d_name);
             if(unlikely(len <= (int)PLUGINSD_FILE_SUFFIX_LEN)) continue;
-            if(unlikely(strsame(PLUGINSD_FILE_SUFFIX, &file->d_name[len - (int)PLUGINSD_FILE_SUFFIX_LEN]) != 0)) {
+            if(unlikely(strcmp(PLUGINSD_FILE_SUFFIX, &file->d_name[len - (int)PLUGINSD_FILE_SUFFIX_LEN]) != 0)) {
                 debug(D_PLUGINSD, "PLUGINSD: File '%s' does not end in '%s'.", file->d_name, PLUGINSD_FILE_SUFFIX);
                 continue;
             }
@@ -492,7 +489,7 @@ void *pluginsd_main(void *ptr) {
 
             // check if it runs already
             for(cd = pluginsd_root ; cd ; cd = cd->next)
-                if(unlikely(strsame(cd->filename, file->d_name) == 0)) break;
+                if(unlikely(strcmp(cd->filename, file->d_name) == 0)) break;
 
             if(likely(cd && !cd->obsolete)) {
                 debug(D_PLUGINSD, "PLUGINSD: plugin '%s' is already running", cd->filename);
index 1c8dfdc98ac7b456fa54096fec360187fe3fc1d9..9ccac6dc7cd0804771274bf4ebf23fd0d93498eb 100644 (file)
@@ -91,7 +91,7 @@ static struct disk *get_disk(unsigned long major, unsigned long minor, char *dis
             struct dirent *dp;
             while( (dp = readdir(dirp)) ) {
                 // . and .. are also files in empty folders.
-                if(unlikely(strsame(dp->d_name, ".") == 0 || strsame(dp->d_name, "..") == 0)) {
+                if(unlikely(strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0)) {
                     continue;
                 }
 
index 69ded9d2c4a16570310459eabdb837075de00f62..82661abd439d8cc03f9abdbdcaacadd809702026 100644 (file)
@@ -77,7 +77,7 @@ static struct netdev *get_netdev(const char *name) {
 
     // search it, from the last position to the end
     for(d = last ; d ; d = d->next) {
-        if(unlikely(hash == d->hash && !strsame(name, d->name))) {
+        if(unlikely(hash == d->hash && !strcmp(name, d->name))) {
             last = d->next;
             return d;
         }
@@ -85,7 +85,7 @@ static struct netdev *get_netdev(const char *name) {
 
     // search it from the beginning to the last position we used
     for(d = netdev_root ; d != last ; d = d->next) {
-        if(unlikely(hash == d->hash && !strsame(name, d->name))) {
+        if(unlikely(hash == d->hash && !strcmp(name, d->name))) {
             last = d->next;
             return d;
         }
index b06825f0c6c775507e90b310e684d52cdadd4b16..c1c39899668b50ae30075cf2f3781fa03cce0b66 100644 (file)
@@ -182,7 +182,7 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
         char *key = procfile_lineword(ff, l, 0);
         uint32_t hash = simple_hash(key);
 
-        if(unlikely(hash == hash_ipext && strsame(key, "IpExt") == 0)) {
+        if(unlikely(hash == hash_ipext && strcmp(key, "IpExt") == 0)) {
             size_t h = l++;
 
             words = procfile_linewords(ff, l);
@@ -334,7 +334,7 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
                 rrdset_done(st);
             }
         }
-        else if(unlikely(hash == hash_tcpext && strsame(key, "TcpExt") == 0)) {
+        else if(unlikely(hash == hash_tcpext && strcmp(key, "TcpExt") == 0)) {
             size_t h = l++;
 
             words = procfile_linewords(ff, l);
index 3300a6058665e9218e6b04df9161404dfa0b27df..9dba08d561877c3972bc4f9a9f6ea03c6579049b 100644 (file)
@@ -151,7 +151,7 @@ int do_proc_net_rpc_nfs(int update_every, usec_t dt) {
     if(do_proc4 == -1) do_proc4 = config_get_boolean("plugin:proc:/proc/net/rpc/nfs", "NFS v4 procedures", 1);
 
     // if they are enabled, reset them to 1
-    // later we do them =2 to avoid doing strsame() for all lines
+    // later we do them =2 to avoid doing strcmp() for all lines
     if(do_net) do_net = 1;
     if(do_rpc) do_rpc = 1;
     if(do_proc2) do_proc2 = 1;
@@ -170,7 +170,7 @@ int do_proc_net_rpc_nfs(int update_every, usec_t dt) {
 
         type        = procfile_lineword(ff, l, 0);
 
-        if(do_net == 1 && strsame(type, "net") == 0) {
+        if(do_net == 1 && strcmp(type, "net") == 0) {
             if(words < 5) {
                 error("%s line of /proc/net/rpc/nfs has %zu words, expected %d", type, words, 5);
                 continue;
@@ -185,7 +185,7 @@ int do_proc_net_rpc_nfs(int update_every, usec_t dt) {
             if(sum == 0ULL) do_net = -1;
             else do_net = 2;
         }
-        else if(do_rpc == 1 && strsame(type, "rpc") == 0) {
+        else if(do_rpc == 1 && strcmp(type, "rpc") == 0) {
             if(words < 4) {
                 error("%s line of /proc/net/rpc/nfs has %zu words, expected %d", type, words, 6);
                 continue;
@@ -199,7 +199,7 @@ int do_proc_net_rpc_nfs(int update_every, usec_t dt) {
             if(sum == 0ULL) do_rpc = -1;
             else do_rpc = 2;
         }
-        else if(do_proc2 == 1 && strsame(type, "proc2") == 0) {
+        else if(do_proc2 == 1 && strcmp(type, "proc2") == 0) {
             // the first number is the count of numbers present
             // so we start for word 2
 
@@ -220,7 +220,7 @@ int do_proc_net_rpc_nfs(int update_every, usec_t dt) {
             }
             else do_proc2 = 2;
         }
-        else if(do_proc3 == 1 && strsame(type, "proc3") == 0) {
+        else if(do_proc3 == 1 && strcmp(type, "proc3") == 0) {
             // the first number is the count of numbers present
             // so we start for word 2
 
@@ -241,7 +241,7 @@ int do_proc_net_rpc_nfs(int update_every, usec_t dt) {
             }
             else do_proc3 = 2;
         }
-        else if(do_proc4 == 1 && strsame(type, "proc4") == 0) {
+        else if(do_proc4 == 1 && strcmp(type, "proc4") == 0) {
             // the first number is the count of numbers present
             // so we start for word 2
 
index 22bd899aa37f255c32481de455a37f4cc479e08c..02a8c8f90115bf35b1c7d73e6caff6f727c40988 100644 (file)
@@ -239,7 +239,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
     if(do_proc4ops == -1) do_proc4ops = config_get_boolean("plugin:proc:/proc/net/rpc/nfsd", "NFS v4 operations", 1);
 
     // if they are enabled, reset them to 1
-    // later we do them =2 to avoid doing strsame() for all lines
+    // later we do them =2 to avoid doing strcmp() for all lines
     if(do_rc) do_rc = 1;
     if(do_fh) do_fh = 1;
     if(do_io) do_io = 1;
@@ -269,7 +269,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
 
         type = procfile_lineword(ff, l, 0);
 
-        if(do_rc == 1 && strsame(type, "rc") == 0) {
+        if(do_rc == 1 && strcmp(type, "rc") == 0) {
             if(words < 4) {
                 error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 4);
                 continue;
@@ -283,7 +283,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
             if(sum == 0ULL) do_rc = -1;
             else do_rc = 2;
         }
-        else if(do_fh == 1 && strsame(type, "fh") == 0) {
+        else if(do_fh == 1 && strcmp(type, "fh") == 0) {
             if(words < 6) {
                 error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 6);
                 continue;
@@ -299,7 +299,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
             if(sum == 0ULL) do_fh = -1;
             else do_fh = 2;
         }
-        else if(do_io == 1 && strsame(type, "io") == 0) {
+        else if(do_io == 1 && strcmp(type, "io") == 0) {
             if(words < 3) {
                 error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 3);
                 continue;
@@ -312,7 +312,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
             if(sum == 0ULL) do_io = -1;
             else do_io = 2;
         }
-        else if(do_th == 1 && strsame(type, "th") == 0) {
+        else if(do_th == 1 && strcmp(type, "th") == 0) {
             if(words < 13) {
                 error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 13);
                 continue;
@@ -343,7 +343,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
             }
             else do_th = 2;
         }
-        else if(do_ra == 1 && strsame(type, "ra") == 0) {
+        else if(do_ra == 1 && strcmp(type, "ra") == 0) {
             if(words < 13) {
                 error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 13);
                 continue;
@@ -372,7 +372,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
             }
             else do_ra = 2;
         }
-        else if(do_net == 1 && strsame(type, "net") == 0) {
+        else if(do_net == 1 && strcmp(type, "net") == 0) {
             if(words < 5) {
                 error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 5);
                 continue;
@@ -387,7 +387,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
             if(sum == 0ULL) do_net = -1;
             else do_net = 2;
         }
-        else if(do_rpc == 1 && strsame(type, "rpc") == 0) {
+        else if(do_rpc == 1 && strcmp(type, "rpc") == 0) {
             if(words < 6) {
                 error("%s line of /proc/net/rpc/nfsd has %zu words, expected %d", type, words, 6);
                 continue;
@@ -402,7 +402,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
             if(sum == 0ULL) do_rpc = -1;
             else do_rpc = 2;
         }
-        else if(do_proc2 == 1 && strsame(type, "proc2") == 0) {
+        else if(do_proc2 == 1 && strcmp(type, "proc2") == 0) {
             // the first number is the count of numbers present
             // so we start for word 2
 
@@ -423,7 +423,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
             }
             else do_proc2 = 2;
         }
-        else if(do_proc3 == 1 && strsame(type, "proc3") == 0) {
+        else if(do_proc3 == 1 && strcmp(type, "proc3") == 0) {
             // the first number is the count of numbers present
             // so we start for word 2
 
@@ -444,7 +444,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
             }
             else do_proc3 = 2;
         }
-        else if(do_proc4 == 1 && strsame(type, "proc4") == 0) {
+        else if(do_proc4 == 1 && strcmp(type, "proc4") == 0) {
             // the first number is the count of numbers present
             // so we start for word 2
 
@@ -465,7 +465,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
             }
             else do_proc4 = 2;
         }
-        else if(do_proc4ops == 1 && strsame(type, "proc4ops") == 0) {
+        else if(do_proc4ops == 1 && strcmp(type, "proc4ops") == 0) {
             // the first number is the count of numbers present
             // so we start for word 2
 
index ffcd282ac3a06e1e64f3017d9bb7ded9fff13a93..cd5c250aee3b1abc824daf2f77b857894741b945 100644 (file)
@@ -165,7 +165,7 @@ static unsigned long long *netstat_columns_find(struct netstat_columns *nc, cons
     uint32_t i, hash = simple_hash(name);
 
     for(i = 0; nc[i].name ;i++)
-        if(unlikely(nc[i].hash == hash && !strsame(nc[i].name, name)))
+        if(unlikely(nc[i].hash == hash && !strcmp(nc[i].name, name)))
             return &nc[i].value;
 
     fatal("Cannot find key '%s' in /proc/net/snmp internal array.", name);
@@ -186,7 +186,7 @@ static void parse_line_pair(procfile *ff, struct netstat_columns *nc, size_t hea
         uint32_t hash = simple_hash(key);
 
         for(i = 0 ; nc[i].name ;i++) {
-            if(unlikely(hash == nc[i].hash && !strsame(key, nc[i].name))) {
+            if(unlikely(hash == nc[i].hash && !strcmp(key, nc[i].name))) {
                 nc[i].value = str2ull(procfile_lineword(ff, values_line, w));
                 break;
             }
@@ -372,10 +372,10 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
         char *key = procfile_lineword(ff, l, 0);
         uint32_t hash = simple_hash(key);
 
-        if(unlikely(hash == hash_ip && strsame(key, "Ip") == 0)) {
+        if(unlikely(hash == hash_ip && strcmp(key, "Ip") == 0)) {
             size_t h = l++;
 
-            if(strsame(procfile_lineword(ff, l, 0), "Ip") != 0) {
+            if(strcmp(procfile_lineword(ff, l, 0), "Ip") != 0) {
                 error("Cannot read Ip line from /proc/net/snmp.");
                 break;
             }
@@ -478,10 +478,10 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
                 rrdset_done(st);
             }
         }
-        else if(unlikely(hash == hash_icmp && strsame(key, "Icmp") == 0)) {
+        else if(unlikely(hash == hash_icmp && strcmp(key, "Icmp") == 0)) {
             size_t h = l++;
 
-            if(strsame(procfile_lineword(ff, l, 0), "Icmp") != 0) {
+            if(strcmp(procfile_lineword(ff, l, 0), "Icmp") != 0) {
                 error("Cannot read Icmp line from /proc/net/snmp.");
                 break;
             }
@@ -528,10 +528,10 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
                 rrdset_done(st);
             }
         }
-        else if(unlikely(hash == hash_icmpmsg && strsame(key, "IcmpMsg") == 0)) {
+        else if(unlikely(hash == hash_icmpmsg && strcmp(key, "IcmpMsg") == 0)) {
             size_t h = l++;
 
-            if(strsame(procfile_lineword(ff, l, 0), "IcmpMsg") != 0) {
+            if(strcmp(procfile_lineword(ff, l, 0), "IcmpMsg") != 0) {
                 error("Cannot read IcmpMsg line from /proc/net/snmp.");
                 break;
             }
@@ -558,10 +558,10 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
                 rrdset_done(st);
             }
         }
-        else if(unlikely(hash == hash_tcp && strsame(key, "Tcp") == 0)) {
+        else if(unlikely(hash == hash_tcp && strcmp(key, "Tcp") == 0)) {
             size_t h = l++;
 
-            if(strsame(procfile_lineword(ff, l, 0), "Tcp") != 0) {
+            if(strcmp(procfile_lineword(ff, l, 0), "Tcp") != 0) {
                 error("Cannot read Tcp line from /proc/net/snmp.");
                 break;
             }
@@ -651,10 +651,10 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
                 rrdset_done(st);
             }
         }
-        else if(unlikely(hash == hash_udp && strsame(key, "Udp") == 0)) {
+        else if(unlikely(hash == hash_udp && strcmp(key, "Udp") == 0)) {
             size_t h = l++;
 
-            if(strsame(procfile_lineword(ff, l, 0), "Udp") != 0) {
+            if(strcmp(procfile_lineword(ff, l, 0), "Udp") != 0) {
                 error("Cannot read Udp line from /proc/net/snmp.");
                 break;
             }
@@ -711,10 +711,10 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
                 rrdset_done(st);
             }
         }
-        else if(unlikely(hash == hash_udplite && strsame(key, "UdpLite") == 0)) {
+        else if(unlikely(hash == hash_udplite && strcmp(key, "UdpLite") == 0)) {
             size_t h = l++;
 
-            if(strsame(procfile_lineword(ff, l, 0), "UdpLite") != 0) {
+            if(strcmp(procfile_lineword(ff, l, 0), "UdpLite") != 0) {
                 error("Cannot read UdpLite line from /proc/net/snmp.");
                 break;
             }
index 49755217e2b7ab7406db785723dad7ea9cb8e3a0..a3f717f17c60e817a9a1d4e68f8c7965357bfcb4 100644 (file)
     (strchr (Fs_name, ':') != NULL               \
      || ((Fs_name)[0] == '/'                     \
          && (Fs_name)[1] == '/'                  \
-         && (strsame (Fs_type, "smbfs") == 0     \
-             || strsame (Fs_type, "cifs") == 0)) \
-     || (strsame("-hosts", Fs_name) == 0))
+         && (strcmp (Fs_type, "smbfs") == 0     \
+             || strcmp (Fs_type, "cifs") == 0)) \
+     || (strcmp("-hosts", Fs_name) == 0))
 #endif
 
 #define ME_DUMMY_0(Fs_name, Fs_type)             \
-  (strsame (Fs_type, "autofs") == 0              \
-   || strsame (Fs_type, "proc") == 0             \
-   || strsame (Fs_type, "subfs") == 0            \
+  (strcmp (Fs_type, "autofs") == 0              \
+   || strcmp (Fs_type, "proc") == 0             \
+   || strcmp (Fs_type, "subfs") == 0            \
    /* for Linux 2.6/3.x */                       \
-   || strsame (Fs_type, "debugfs") == 0          \
-   || strsame (Fs_type, "devpts") == 0           \
-   || strsame (Fs_type, "fusectl") == 0          \
-   || strsame (Fs_type, "mqueue") == 0           \
-   || strsame (Fs_type, "rpc_pipefs") == 0       \
-   || strsame (Fs_type, "sysfs") == 0            \
+   || strcmp (Fs_type, "debugfs") == 0          \
+   || strcmp (Fs_type, "devpts") == 0           \
+   || strcmp (Fs_type, "fusectl") == 0          \
+   || strcmp (Fs_type, "mqueue") == 0           \
+   || strcmp (Fs_type, "rpc_pipefs") == 0       \
+   || strcmp (Fs_type, "sysfs") == 0            \
    /* FreeBSD, Linux 2.4 */                      \
-   || strsame (Fs_type, "devfs") == 0            \
+   || strcmp (Fs_type, "devfs") == 0            \
    /* for NetBSD 3.0 */                          \
-   || strsame (Fs_type, "kernfs") == 0           \
+   || strcmp (Fs_type, "kernfs") == 0           \
    /* for Irix 6.5 */                            \
-   || strsame (Fs_type, "ignore") == 0)
+   || strcmp (Fs_type, "ignore") == 0)
 
 /* Historically, we have marked as "dummy" any file system of type "none",
    but now that programs like du need to know about bind-mounted directories,
    we grant an exception to any with "bind" in its list of mount options.
    I.e., those are *not* dummy entries.  */
 # define ME_DUMMY(Fs_name, Fs_type)            \
-  (ME_DUMMY_0 (Fs_name, Fs_type) || strsame (Fs_type, "none") == 0)
+  (ME_DUMMY_0 (Fs_name, Fs_type) || strcmp (Fs_type, "none") == 0)
 
 // ----------------------------------------------------------------------------
 
@@ -66,8 +66,8 @@ struct mountinfo *mountinfo_find_by_filesystem_mount_source(struct mountinfo *ro
                 && mi->mount_source
                 && mi->filesystem_hash == filesystem_hash
                 && mi->mount_source_hash == mount_source_hash
-                && !strsame(mi->filesystem, filesystem)
-                && !strsame(mi->mount_source, mount_source)))
+                && !strcmp(mi->filesystem, filesystem)
+                && !strcmp(mi->mount_source, mount_source)))
             return mi;
 
     return NULL;
@@ -83,7 +83,7 @@ struct mountinfo *mountinfo_find_by_filesystem_super_option(struct mountinfo *ro
         if(unlikely(mi->filesystem
                 && mi->super_options
                 && mi->filesystem_hash == filesystem_hash
-                && !strsame(mi->filesystem, filesystem))) {
+                && !strcmp(mi->filesystem, filesystem))) {
 
             // super_options is a comma separated list
             char *s = mi->super_options, *e;
@@ -163,7 +163,7 @@ static inline int is_read_only(const char *s) {
     size_t len = strlen(s);
     if(len < 2) return 0;
     if(len == 2) {
-        if(!strsame(s, "ro")) return 1;
+        if(!strcmp(s, "ro")) return 1;
         return 0;
     }
     if(!strncmp(s, "ro,", 3)) return 1;
@@ -376,7 +376,7 @@ struct mountinfo *mountinfo_read(int do_statvfs) {
                 if(unlikely(bind)) {
                     struct mountinfo *mi;
                     for(mi = root; mi ; mi = mi->next) {
-                        if(unlikely(strsame(mnt->mnt_dir, mi->mount_point) == 0)) {
+                        if(unlikely(strcmp(mnt->mnt_dir, mi->mount_point) == 0)) {
                             fprintf(stderr, "Mount point '%s' is BIND\n", mi->mount_point);
                             mi->flags |= MOUNTINFO_IS_BIND;
                             break;
index 11096aa8314da967ec8adb73f37dfdae7ae0028f..f7e6d5bc007184074133d4768f2785f303a683fd 100644 (file)
@@ -73,7 +73,7 @@ int do_proc_stat(int update_every, usec_t dt) {
             long priority;
             int isthistotal;
 
-            if(unlikely(strsame(id, "cpu")) == 0) {
+            if(unlikely(strcmp(id, "cpu")) == 0) {
                 title = "Total CPU utilization";
                 type = "system";
                 context = "system.cpu";
@@ -126,7 +126,7 @@ int do_proc_stat(int update_every, usec_t dt) {
                 rrdset_done(st);
             }
         }
-        else if(unlikely(hash == hash_intr && strsame(row_key, "intr") == 0)) {
+        else if(unlikely(hash == hash_intr && strcmp(row_key, "intr") == 0)) {
             unsigned long long value = str2ull(procfile_lineword(ff, l, 1));
 
             // --------------------------------------------------------------------
@@ -145,7 +145,7 @@ int do_proc_stat(int update_every, usec_t dt) {
                 rrdset_done(st);
             }
         }
-        else if(unlikely(hash == hash_ctxt && strsame(row_key, "ctxt") == 0)) {
+        else if(unlikely(hash == hash_ctxt && strcmp(row_key, "ctxt") == 0)) {
             unsigned long long value = str2ull(procfile_lineword(ff, l, 1));
 
             // --------------------------------------------------------------------
@@ -163,13 +163,13 @@ int do_proc_stat(int update_every, usec_t dt) {
                 rrdset_done(st);
             }
         }
-        else if(unlikely(hash == hash_processes && !processes && strsame(row_key, "processes") == 0)) {
+        else if(unlikely(hash == hash_processes && !processes && strcmp(row_key, "processes") == 0)) {
             processes = str2ull(procfile_lineword(ff, l, 1));
         }
-        else if(unlikely(hash == hash_procs_running && !running && strsame(row_key, "procs_running") == 0)) {
+        else if(unlikely(hash == hash_procs_running && !running && strcmp(row_key, "procs_running") == 0)) {
             running = str2ull(procfile_lineword(ff, l, 1));
         }
-        else if(unlikely(hash == hash_procs_blocked && !blocked && strsame(row_key, "procs_blocked") == 0)) {
+        else if(unlikely(hash == hash_procs_blocked && !blocked && strcmp(row_key, "procs_blocked") == 0)) {
             blocked = str2ull(procfile_lineword(ff, l, 1));
         }
     }
index 97bda8093a625811335c640faee339f686883652..d223cd6f1e5076efe4714b32deff61ab4820c35d 100644 (file)
@@ -158,7 +158,7 @@ int registry_request_access_json(struct web_client *w, char *person_guid, char *
         return 200;
     }
 
-    if(unlikely(person_guid[0] && !strsame(person_guid, REGISTRY_VERIFY_COOKIES_GUID)))
+    if(unlikely(person_guid[0] && !strcmp(person_guid, REGISTRY_VERIFY_COOKIES_GUID)))
         person_guid[0] = '\0';
 
     // ------------------------------------------------------------------------
index a8c4438060039bafc5c62db443033796cfa386e6..d32d549e28352e9a87365068d6fc173e6945b4ad 100644 (file)
@@ -17,7 +17,7 @@ int registry_regenerate_guid(const char *guid, char *result) {
         uuid_unparse_lower(uuid, result);
 
 #ifdef NETDATA_INTERNAL_CHECKS
-        if(strsame(guid, result))
+        if(strcmp(guid, result))
             info("Registry: source GUID '%s' and re-generated GUID '%s' differ!", guid, result);
 #endif /* NETDATA_INTERNAL_CHECKS */
     }
@@ -175,7 +175,7 @@ REGISTRY_PERSON *registry_request_delete(char *person_guid, char *machine_guid,
     delete_url = registry_fix_url(delete_url, NULL);
 
     // make sure the user is not deleting the url it uses
-    if(!strsame(delete_url, pu->url->url)) {
+    if(!strcmp(delete_url, pu->url->url)) {
         info("Registry Delete Request: delete URL is the one currently accessed, person: '%s', machine '%s', url '%s', delete url '%s'"
              , p->guid, m->guid, pu->url->url, delete_url);
         return NULL;
@@ -264,8 +264,8 @@ static inline int is_machine_guid_blacklisted(const char *guid) {
     // we blacklist them here, so that the next version of netdata will generate
     // new ones.
 
-    if(!strsame(guid, "8a795b0c-2311-11e6-8563-000c295076a6")
-       || !strsame(guid, "4aed1458-1c3e-11e6-a53f-000c290fc8f5")
+    if(!strcmp(guid, "8a795b0c-2311-11e6-8563-000c295076a6")
+       || !strcmp(guid, "4aed1458-1c3e-11e6-a53f-000c290fc8f5")
             ) {
         error("Blacklisted machine GUID '%s' found.", guid);
         return 1;
index 6b18672e492bf73a8e8fcd012a501b8abe710229..5f9099c9aa6995eb2bc761910c31865a680393d9 100644 (file)
@@ -9,7 +9,7 @@ int person_url_compare(void *a, void *b) {
 
     if(hash1 < hash2) return -1;
     else if(hash1 > hash2) return 1;
-    else return strsame(((REGISTRY_PERSON_URL *)a)->url->url, ((REGISTRY_PERSON_URL *)b)->url->url);
+    else return strcmp(((REGISTRY_PERSON_URL *)a)->url->url, ((REGISTRY_PERSON_URL *)b)->url->url);
 }
 
 inline REGISTRY_PERSON_URL *registry_person_url_index_find(REGISTRY_PERSON *p, const char *url) {
@@ -242,7 +242,7 @@ REGISTRY_PERSON_URL *registry_person_link_to_url(REGISTRY_PERSON *p, REGISTRY_MA
             pu->machine = m;
         }
 
-        if(strsame(pu->machine_name, name)) {
+        if(strcmp(pu->machine_name, name)) {
             // the name of the PERSON_URL has changed !
             pu = registry_person_url_reallocate(p, m, u, name, namelen, when, pu);
         }
index b7412adaf3706f66cf4bb18c805698c81ddaef50..52d36a898e285b713bc7ac4e969d9118071e2313 100644 (file)
@@ -6,7 +6,7 @@
 int registry_url_compare(void *a, void *b) {
     if(((REGISTRY_URL *)a)->hash < ((REGISTRY_URL *)b)->hash) return -1;
     else if(((REGISTRY_URL *)a)->hash > ((REGISTRY_URL *)b)->hash) return 1;
-    else return strsame(((REGISTRY_URL *)a)->url, ((REGISTRY_URL *)b)->url);
+    else return strcmp(((REGISTRY_URL *)a)->url, ((REGISTRY_URL *)b)->url);
 }
 
 inline REGISTRY_URL *registry_url_index_add(REGISTRY_URL *u) {
index bd15c765007b043ceae6a8f42a15ea372f79f5d5..27e8e6b235620fe004ee371ec7e1108f08fd9c1b 100644 (file)
--- a/src/rrd.c
+++ b/src/rrd.c
@@ -91,7 +91,7 @@ void rrdhost_check_wrlock_int(RRDHOST *host, const char *file, const char *funct
 static int rrdfamily_compare(void *a, void *b) {
     if(((RRDFAMILY *)a)->hash_family < ((RRDFAMILY *)b)->hash_family) return -1;
     else if(((RRDFAMILY *)a)->hash_family > ((RRDFAMILY *)b)->hash_family) return 1;
-    else return strsame(((RRDFAMILY *)a)->family, ((RRDFAMILY *)b)->family);
+    else return strcmp(((RRDFAMILY *)a)->family, ((RRDFAMILY *)b)->family);
 }
 
 #define rrdfamily_index_add(host, rc) (RRDFAMILY *)avl_insert_lock(&((host)->rrdfamily_root_index), (avl *)(rc))
@@ -146,7 +146,7 @@ void rrdfamily_free(RRDFAMILY *rc) {
 static int rrdset_compare(void* a, void* b) {
     if(((RRDSET *)a)->hash < ((RRDSET *)b)->hash) return -1;
     else if(((RRDSET *)a)->hash > ((RRDSET *)b)->hash) return 1;
-    else return strsame(((RRDSET *)a)->id, ((RRDSET *)b)->id);
+    else return strcmp(((RRDSET *)a)->id, ((RRDSET *)b)->id);
 }
 
 #define rrdset_index_add(host, st) (RRDSET *)avl_insert_lock(&((host)->rrdset_root_index), (avl *)(st))
@@ -173,7 +173,7 @@ static int rrdset_compare_name(void* a, void* b) {
 
     if(A->hash_name < B->hash_name) return -1;
     else if(A->hash_name > B->hash_name) return 1;
-    else return strsame(A->name, B->name);
+    else return strcmp(A->name, B->name);
 }
 
 RRDSET *rrdset_index_add_name(RRDHOST *host, RRDSET *st) {
@@ -202,7 +202,7 @@ static RRDSET *rrdset_index_find_name(RRDHOST *host, const char *name, uint32_t
     result = avl_search_lock(&host->rrdset_root_index_name, (avl *) (&(tmp.avlname)));
     if(result) {
         RRDSET *st = rrdset_from_avlname(result);
-        if(strsame(st->magic, RRDSET_MAGIC))
+        if(strcmp(st->magic, RRDSET_MAGIC))
             error("Search for RRDSET %s returned an invalid RRDSET %s (name %s)", name, st->id, st->name);
 
         // fprintf(stderr, "FOUND: %s\n", name);
@@ -219,7 +219,7 @@ static RRDSET *rrdset_index_find_name(RRDHOST *host, const char *name, uint32_t
 static int rrddim_compare(void* a, void* b) {
     if(((RRDDIM *)a)->hash < ((RRDDIM *)b)->hash) return -1;
     else if(((RRDDIM *)a)->hash > ((RRDDIM *)b)->hash) return 1;
-    else return strsame(((RRDDIM *)a)->id, ((RRDDIM *)b)->id);
+    else return strcmp(((RRDDIM *)a)->id, ((RRDDIM *)b)->id);
 }
 
 #define rrddim_index_add(st, rd) (RRDDIM *)avl_insert_lock(&((st)->dimensions_index), (avl *)(rd))
@@ -238,9 +238,9 @@ static RRDDIM *rrddim_index_find(RRDSET *st, const char *id, uint32_t hash) {
 
 int rrdset_type_id(const char *name)
 {
-    if(unlikely(strsame(name, RRDSET_TYPE_AREA_NAME) == 0)) return RRDSET_TYPE_AREA;
-    else if(unlikely(strsame(name, RRDSET_TYPE_STACKED_NAME) == 0)) return RRDSET_TYPE_STACKED;
-    else if(unlikely(strsame(name, RRDSET_TYPE_LINE_NAME) == 0)) return RRDSET_TYPE_LINE;
+    if(unlikely(strcmp(name, RRDSET_TYPE_AREA_NAME) == 0)) return RRDSET_TYPE_AREA;
+    else if(unlikely(strcmp(name, RRDSET_TYPE_STACKED_NAME) == 0)) return RRDSET_TYPE_STACKED;
+    else if(unlikely(strcmp(name, RRDSET_TYPE_LINE_NAME) == 0)) return RRDSET_TYPE_LINE;
     return RRDSET_TYPE_LINE;
 }
 
@@ -289,9 +289,9 @@ const char *rrd_memory_mode_name(int id)
 
 int rrd_memory_mode_id(const char *name)
 {
-    if(unlikely(!strsame(name, RRD_MEMORY_MODE_RAM_NAME)))
+    if(unlikely(!strcmp(name, RRD_MEMORY_MODE_RAM_NAME)))
         return RRD_MEMORY_MODE_RAM;
-    else if(unlikely(!strsame(name, RRD_MEMORY_MODE_MAP_NAME)))
+    else if(unlikely(!strcmp(name, RRD_MEMORY_MODE_MAP_NAME)))
         return RRD_MEMORY_MODE_MAP;
 
     return RRD_MEMORY_MODE_SAVE;
@@ -302,10 +302,10 @@ int rrd_memory_mode_id(const char *name)
 
 int rrddim_algorithm_id(const char *name)
 {
-    if(strsame(name, RRDDIM_INCREMENTAL_NAME) == 0)          return RRDDIM_INCREMENTAL;
-    if(strsame(name, RRDDIM_ABSOLUTE_NAME) == 0)             return RRDDIM_ABSOLUTE;
-    if(strsame(name, RRDDIM_PCENT_OVER_ROW_TOTAL_NAME) == 0)         return RRDDIM_PCENT_OVER_ROW_TOTAL;
-    if(strsame(name, RRDDIM_PCENT_OVER_DIFF_TOTAL_NAME) == 0)    return RRDDIM_PCENT_OVER_DIFF_TOTAL;
+    if(strcmp(name, RRDDIM_INCREMENTAL_NAME) == 0)          return RRDDIM_INCREMENTAL;
+    if(strcmp(name, RRDDIM_ABSOLUTE_NAME) == 0)             return RRDDIM_ABSOLUTE;
+    if(strcmp(name, RRDDIM_PCENT_OVER_ROW_TOTAL_NAME) == 0)         return RRDDIM_PCENT_OVER_ROW_TOTAL;
+    if(strcmp(name, RRDDIM_PCENT_OVER_DIFF_TOTAL_NAME) == 0)    return RRDDIM_PCENT_OVER_DIFF_TOTAL;
     return RRDDIM_ABSOLUTE;
 }
 
@@ -353,7 +353,7 @@ char *rrdset_strncpyz_name(char *to, const char *from, size_t length)
 
 void rrdset_set_name(RRDSET *st, const char *name)
 {
-    if(unlikely(st->name && !strsame(st->name, name)))
+    if(unlikely(st->name && !strcmp(st->name, name)))
         return;
 
     debug(D_RRD_CALLS, "rrdset_set_name() old: %s, new: %s", st->name, name);
@@ -504,12 +504,12 @@ RRDSET *rrdset_create(const char *type, const char *id, const char *name, const
     snprintfz(fullfilename, FILENAME_MAX, "%s/main.db", cache_dir);
     if(rrd_memory_mode != RRD_MEMORY_MODE_RAM) st = (RRDSET *)mymmap(fullfilename, size, ((rrd_memory_mode == RRD_MEMORY_MODE_MAP)?MAP_SHARED:MAP_PRIVATE), 0);
     if(st) {
-        if(strsame(st->magic, RRDSET_MAGIC) != 0) {
+        if(strcmp(st->magic, RRDSET_MAGIC) != 0) {
             errno = 0;
             info("Initializing file %s.", fullfilename);
             memset(st, 0, size);
         }
-        else if(strsame(st->id, fullid) != 0) {
+        else if(strcmp(st->id, fullid) != 0) {
             errno = 0;
             error("File %s contents are not for chart %s. Clearing it.", fullfilename, fullid);
             // munmap(st, size);
@@ -588,7 +588,7 @@ RRDSET *rrdset_create(const char *type, const char *id, const char *name, const
     st->isdetail = 0;
     st->debug = 0;
 
-    // if(!strsame(st->id, "disk_util.dm-0")) {
+    // if(!strcmp(st->id, "disk_util.dm-0")) {
     //     st->debug = 1;
     //     error("enabled debugging for '%s'", st->id);
     // }
@@ -672,7 +672,7 @@ RRDDIM *rrddim_add(RRDSET *st, const char *id, const char *name, long multiplier
         struct timeval now;
         now_realtime_timeval(&now);
 
-        if(strsame(rd->magic, RRDDIMENSION_MAGIC) != 0) {
+        if(strcmp(rd->magic, RRDDIMENSION_MAGIC) != 0) {
             errno = 0;
             info("Initializing file %s.", fullfilename);
             memset(rd, 0, size);
@@ -707,7 +707,7 @@ RRDDIM *rrddim_add(RRDSET *st, const char *id, const char *name, long multiplier
             error("File %s is too old. Clearing it.", fullfilename);
             memset(rd, 0, size);
         }
-        else if(strsame(rd->id, id) != 0) {
+        else if(strcmp(rd->id, id) != 0) {
             errno = 0;
             error("File %s contents are not for dimension %s. Clearing it.", fullfilename, id);
             // munmap(rd, size);
@@ -795,7 +795,7 @@ RRDDIM *rrddim_add(RRDSET *st, const char *id, const char *name, long multiplier
 
 void rrddim_set_name(RRDSET *st, RRDDIM *rd, const char *name)
 {
-    if(unlikely(rd->name && !strsame(rd->name, name)))
+    if(unlikely(rd->name && !strcmp(rd->name, name)))
         return;
 
     debug(D_RRD_CALLS, "rrddim_set_name() from %s.%s to %s.%s", st->name, rd->name, st->name, name);
index 02c4547b718b74374f4124f536e4c8fd28602b91..067475006d03675171db9f37a37120db4cd274ac 100644 (file)
@@ -561,7 +561,7 @@ void rrdr_disable_not_selected_dimensions(RRDR *r, const char *dims)
 
         // find it and enable it
         for(c = 0, d = r->st->dimensions; d ;c++, d = d->next) {
-            if(unlikely((hash == d->hash && !strsame(d->id, tok)) || !strsame(d->name, tok))) {
+            if(unlikely((hash == d->hash && !strcmp(d->id, tok)) || !strcmp(d->name, tok))) {
                 r->od[c] &= ~RRDR_HIDDEN;
 
                 // since the user needs this dimension
index 6bed558548f697fa718f92418f2baf719246ec22..7e4424297f86c2c311f58a57dedaa6221dddf144 100644 (file)
@@ -147,7 +147,7 @@ static inline int match_pattern(struct simple_pattern *m, const char *str, size_
                 break;
 
             case SIMPLE_PATTERN_SUFFIX:
-                if(unlikely(strsame(&str[len - m->len], m->match) == 0)) {
+                if(unlikely(strcmp(&str[len - m->len], m->match) == 0)) {
                     if(!m->child) return 1;
                     return 0;
                 }
@@ -155,7 +155,7 @@ static inline int match_pattern(struct simple_pattern *m, const char *str, size_
 
             case SIMPLE_PATTERN_EXACT:
             default:
-                if(unlikely(strsame(str, m->match) == 0)) {
+                if(unlikely(strcmp(str, m->match) == 0)) {
                     if(!m->child) return 1;
                     return 0;
                 }
index d7a972fea020a22288e5dba07ccb5f03e4af2ce6..f4b3db2d235260cc2d02b6076fcf59ea459b8e6a 100644 (file)
@@ -424,10 +424,10 @@ static inline void cgroup_read_cpuacct_stat(struct cpuacct_stat *cp) {
             char *s = procfile_lineword(ff, i, 0);
             uint32_t hash = simple_hash(s);
 
-            if(unlikely(hash == user_hash && !strsame(s, "user")))
+            if(unlikely(hash == user_hash && !strcmp(s, "user")))
                 cp->user = str2ull(procfile_lineword(ff, i, 1));
 
-            else if(unlikely(hash == system_hash && !strsame(s, "system")))
+            else if(unlikely(hash == system_hash && !strcmp(s, "system")))
                 cp->system = str2ull(procfile_lineword(ff, i, 1));
         }
 
@@ -534,20 +534,20 @@ static inline void cgroup_read_blkio(struct blkio *io) {
             char *s = procfile_lineword(ff, i, 1);
             uint32_t hash = simple_hash(s);
 
-            if(unlikely(hash == Read_hash && !strsame(s, "Read")))
+            if(unlikely(hash == Read_hash && !strcmp(s, "Read")))
                 io->Read += str2ull(procfile_lineword(ff, i, 2));
 
-            else if(unlikely(hash == Write_hash && !strsame(s, "Write")))
+            else if(unlikely(hash == Write_hash && !strcmp(s, "Write")))
                 io->Write += str2ull(procfile_lineword(ff, i, 2));
 
 /*
-            else if(unlikely(hash == Sync_hash && !strsame(s, "Sync")))
+            else if(unlikely(hash == Sync_hash && !strcmp(s, "Sync")))
                 io->Sync += str2ull(procfile_lineword(ff, i, 2));
 
-            else if(unlikely(hash == Async_hash && !strsame(s, "Async")))
+            else if(unlikely(hash == Async_hash && !strcmp(s, "Async")))
                 io->Async += str2ull(procfile_lineword(ff, i, 2));
 
-            else if(unlikely(hash == Total_hash && !strsame(s, "Total")))
+            else if(unlikely(hash == Total_hash && !strcmp(s, "Total")))
                 io->Total += str2ull(procfile_lineword(ff, i, 2));
 */
         }
@@ -846,7 +846,7 @@ static inline struct cgroup *cgroup_add(const char *id) {
     if(cg->enabled) {
         struct cgroup *t;
         for (t = cgroup_root; t; t = t->next) {
-            if (t != cg && t->enabled && t->hash_chart == cg->hash_chart && !strsame(t->chart_id, cg->chart_id)) {
+            if (t != cg && t->enabled && t->hash_chart == cg->hash_chart && !strcmp(t->chart_id, cg->chart_id)) {
                 if (!strncmp(t->chart_id, "/system.slice/", 14) && !strncmp(cg->chart_id, "/init.scope/system.slice/", 25)) {
                     error("Control group with chart id '%s' already exists with id '%s' and is enabled. Swapping them by enabling cgroup with id '%s' and disabling cgroup with id '%s'.",
                           cg->chart_id, t->id, cg->id, t->id);
@@ -914,7 +914,7 @@ static inline struct cgroup *cgroup_find(const char *id) {
 
     struct cgroup *cg;
     for(cg = cgroup_root; cg ; cg = cg->next) {
-        if(hash == cg->hash && strsame(id, cg->id) == 0)
+        if(hash == cg->hash && strcmp(id, cg->id) == 0)
             break;
     }
 
@@ -1034,7 +1034,7 @@ static inline void cleanup_all_cgroups() {
             {
                 struct cgroup *t;
                 for(t = cgroup_root; t ; t = t->next) {
-                    if(t != cg && t->available && !t->enabled && t->options & CGROUP_OPTIONS_DISABLED_DUPLICATE && t->hash_chart == cg->hash_chart && !strsame(t->chart_id, cg->chart_id)) {
+                    if(t != cg && t->available && !t->enabled && t->options & CGROUP_OPTIONS_DISABLED_DUPLICATE && t->hash_chart == cg->hash_chart && !strcmp(t->chart_id, cg->chart_id)) {
                         debug(D_CGROUP, "Enabling duplicate of cgroup '%s' with id '%s', because the original with id '%s' stopped.", t->chart_id, t->id, cg->id);
                         t->enabled = 1;
                         t->options &= ~CGROUP_OPTIONS_DISABLED_DUPLICATE;
index 899e5c09e00424a81642adbf0f674050101f19c6..bc05f0d8d32f59f8aea65c69e7f628a51238e532 100644 (file)
@@ -21,7 +21,7 @@ static inline void _buffer_overflow_check(BUFFER *b, const char *file, const cha
         b->len = b->size;
     }
 
-    if(b->buffer[b->size] != '\0' || strsame(&b->buffer[b->size + 1], BUFFER_OVERFLOW_EOF)) {
+    if(b->buffer[b->size] != '\0' || strcmp(&b->buffer[b->size + 1], BUFFER_OVERFLOW_EOF)) {
         error("BUFFER: detected overflow at line %lu, at function %s() of file '%s'.", line, function, file);
         buffer_overflow_init(b);
     }
index dba9bdd166583ca99119d3aaf5884b1e608f35c6..cac365ab14e719d4f26d175b3ab8e0eb8fa0a07b 100644 (file)
@@ -369,25 +369,25 @@ cleanup:
 }
 
 static inline const char *fix_units(const char *units) {
-    if(!units || !*units || !strsame(units, "empty") || !strsame(units, "null")) return "";
-    if(!strsame(units, "percentage") || !strsame(units, "percent") || !strsame(units, "pcent")) return "%";
+    if(!units || !*units || !strcmp(units, "empty") || !strcmp(units, "null")) return "";
+    if(!strcmp(units, "percentage") || !strcmp(units, "percent") || !strcmp(units, "pcent")) return "%";
     return units;
 }
 
 static inline const char *color_map(const char *color) {
     // colors from:
     // https://github.com/badges/shields/blob/master/colorscheme.json
-         if(!strsame(color, "brightgreen")) return "#4c1";
-    else if(!strsame(color, "green"))       return "#97CA00";
-    else if(!strsame(color, "yellow"))      return "#dfb317";
-    else if(!strsame(color, "yellowgreen")) return "#a4a61d";
-    else if(!strsame(color, "orange"))      return "#fe7d37";
-    else if(!strsame(color, "red"))         return "#e05d44";
-    else if(!strsame(color, "blue"))        return "#007ec6";
-    else if(!strsame(color, "grey"))        return "#555";
-    else if(!strsame(color, "gray"))        return "#555";
-    else if(!strsame(color, "lightgrey"))   return "#9f9f9f";
-    else if(!strsame(color, "lightgray"))   return "#9f9f9f";
+         if(!strcmp(color, "brightgreen")) return "#4c1";
+    else if(!strcmp(color, "green"))       return "#97CA00";
+    else if(!strcmp(color, "yellow"))      return "#dfb317";
+    else if(!strcmp(color, "yellowgreen")) return "#a4a61d";
+    else if(!strcmp(color, "orange"))      return "#fe7d37";
+    else if(!strcmp(color, "red"))         return "#e05d44";
+    else if(!strcmp(color, "blue"))        return "#007ec6";
+    else if(!strcmp(color, "grey"))        return "#555";
+    else if(!strcmp(color, "gray"))        return "#555";
+    else if(!strcmp(color, "lightgrey"))   return "#9f9f9f";
+    else if(!strcmp(color, "lightgray"))   return "#9f9f9f";
     return color;
 }
 
@@ -466,7 +466,7 @@ static inline void calc_colorz(const char *color, char *final, size_t len, calcu
             *dv = '\0';
 
             if(value_is_null) {
-                if(!*value_buffer || !strsame(value_buffer, "null"))
+                if(!*value_buffer || !strcmp(value_buffer, "null"))
                     break;
             }
             else {
@@ -525,7 +525,7 @@ void buffer_svg(BUFFER *wb, const char *label, calculated_number value, const ch
     if(unlikely(isalnum(*units)))
         separator = " ";
 
-    if(unlikely(!strsame(units, "seconds"))) {
+    if(unlikely(!strcmp(units, "seconds"))) {
         size_t s = (size_t)value;
         size_t d = s / 86400;
         s = s % 86400;
@@ -542,7 +542,7 @@ void buffer_svg(BUFFER *wb, const char *label, calculated_number value, const ch
             snprintfz(value_string, VALUE_STRING_SIZE, "%02zu:%02zu:%02zu", h, m, s);
     }
 
-    else if(unlikely(!strsame(units, "minutes"))) {
+    else if(unlikely(!strcmp(units, "minutes"))) {
         size_t m = (size_t)value;
         size_t d = m / (60 * 24);
         m = m % (60 * 24);
@@ -556,7 +556,7 @@ void buffer_svg(BUFFER *wb, const char *label, calculated_number value, const ch
             snprintfz(value_string, VALUE_STRING_SIZE, "%zuh %zum", h, m);
     }
 
-    else if(unlikely(!strsame(units, "hours"))) {
+    else if(unlikely(!strcmp(units, "hours"))) {
         size_t h = (size_t)value;
         size_t d = h / 24;
         h = h % 24;
index bd04791317bd730efe51721160fa2aaa5c6c1ca0..4b6ccf6469e7d1c9070be807028dd949c6294941 100644 (file)
@@ -544,29 +544,29 @@ uint32_t web_client_api_request_v1_data_options(char *o)
     while(o && *o && (tok = mystrsep(&o, ", |"))) {
         if(!*tok) continue;
 
-        if(!strsame(tok, "nonzero"))
+        if(!strcmp(tok, "nonzero"))
             ret |= RRDR_OPTION_NONZERO;
-        else if(!strsame(tok, "flip") || !strsame(tok, "reversed") || !strsame(tok, "reverse"))
+        else if(!strcmp(tok, "flip") || !strcmp(tok, "reversed") || !strcmp(tok, "reverse"))
             ret |= RRDR_OPTION_REVERSED;
-        else if(!strsame(tok, "jsonwrap"))
+        else if(!strcmp(tok, "jsonwrap"))
             ret |= RRDR_OPTION_JSON_WRAP;
-        else if(!strsame(tok, "min2max"))
+        else if(!strcmp(tok, "min2max"))
             ret |= RRDR_OPTION_MIN2MAX;
-        else if(!strsame(tok, "ms") || !strsame(tok, "milliseconds"))
+        else if(!strcmp(tok, "ms") || !strcmp(tok, "milliseconds"))
             ret |= RRDR_OPTION_MILLISECONDS;
-        else if(!strsame(tok, "abs") || !strsame(tok, "absolute") || !strsame(tok, "absolute_sum") || !strsame(tok, "absolute-sum"))
+        else if(!strcmp(tok, "abs") || !strcmp(tok, "absolute") || !strcmp(tok, "absolute_sum") || !strcmp(tok, "absolute-sum"))
             ret |= RRDR_OPTION_ABSOLUTE;
-        else if(!strsame(tok, "seconds"))
+        else if(!strcmp(tok, "seconds"))
             ret |= RRDR_OPTION_SECONDS;
-        else if(!strsame(tok, "null2zero"))
+        else if(!strcmp(tok, "null2zero"))
             ret |= RRDR_OPTION_NULL2ZERO;
-        else if(!strsame(tok, "objectrows"))
+        else if(!strcmp(tok, "objectrows"))
             ret |= RRDR_OPTION_OBJECTSROWS;
-        else if(!strsame(tok, "google_json"))
+        else if(!strcmp(tok, "google_json"))
             ret |= RRDR_OPTION_GOOGLE_JSON;
-        else if(!strsame(tok, "percentage"))
+        else if(!strcmp(tok, "percentage"))
             ret |= RRDR_OPTION_PERCENTAGE;
-        else if(!strsame(tok, "unaligned"))
+        else if(!strcmp(tok, "unaligned"))
             ret |= RRDR_OPTION_NOT_ALIGNED;
     }
 
@@ -575,37 +575,37 @@ uint32_t web_client_api_request_v1_data_options(char *o)
 
 uint32_t web_client_api_request_v1_data_format(char *name)
 {
-    if(!strsame(name, DATASOURCE_FORMAT_DATATABLE_JSON)) // datatable
+    if(!strcmp(name, DATASOURCE_FORMAT_DATATABLE_JSON)) // datatable
         return DATASOURCE_DATATABLE_JSON;
 
-    else if(!strsame(name, DATASOURCE_FORMAT_DATATABLE_JSONP)) // datasource
+    else if(!strcmp(name, DATASOURCE_FORMAT_DATATABLE_JSONP)) // datasource
         return DATASOURCE_DATATABLE_JSONP;
 
-    else if(!strsame(name, DATASOURCE_FORMAT_JSON)) // json
+    else if(!strcmp(name, DATASOURCE_FORMAT_JSON)) // json
         return DATASOURCE_JSON;
 
-    else if(!strsame(name, DATASOURCE_FORMAT_JSONP)) // jsonp
+    else if(!strcmp(name, DATASOURCE_FORMAT_JSONP)) // jsonp
         return DATASOURCE_JSONP;
 
-    else if(!strsame(name, DATASOURCE_FORMAT_SSV)) // ssv
+    else if(!strcmp(name, DATASOURCE_FORMAT_SSV)) // ssv
         return DATASOURCE_SSV;
 
-    else if(!strsame(name, DATASOURCE_FORMAT_CSV)) // csv
+    else if(!strcmp(name, DATASOURCE_FORMAT_CSV)) // csv
         return DATASOURCE_CSV;
 
-    else if(!strsame(name, DATASOURCE_FORMAT_TSV) || !strsame(name, "tsv-excel")) // tsv
+    else if(!strcmp(name, DATASOURCE_FORMAT_TSV) || !strcmp(name, "tsv-excel")) // tsv
         return DATASOURCE_TSV;
 
-    else if(!strsame(name, DATASOURCE_FORMAT_HTML)) // html
+    else if(!strcmp(name, DATASOURCE_FORMAT_HTML)) // html
         return DATASOURCE_HTML;
 
-    else if(!strsame(name, DATASOURCE_FORMAT_JS_ARRAY)) // array
+    else if(!strcmp(name, DATASOURCE_FORMAT_JS_ARRAY)) // array
         return DATASOURCE_JS_ARRAY;
 
-    else if(!strsame(name, DATASOURCE_FORMAT_SSV_COMMA)) // ssvcomma
+    else if(!strcmp(name, DATASOURCE_FORMAT_SSV_COMMA)) // ssvcomma
         return DATASOURCE_SSV_COMMA;
 
-    else if(!strsame(name, DATASOURCE_FORMAT_CSV_JSON_ARRAY)) // csvjsonarray
+    else if(!strcmp(name, DATASOURCE_FORMAT_CSV_JSON_ARRAY)) // csvjsonarray
         return DATASOURCE_CSV_JSON_ARRAY;
 
     return DATASOURCE_JSON;
@@ -613,16 +613,16 @@ uint32_t web_client_api_request_v1_data_format(char *name)
 
 uint32_t web_client_api_request_v1_data_google_format(char *name)
 {
-    if(!strsame(name, "json"))
+    if(!strcmp(name, "json"))
         return DATASOURCE_DATATABLE_JSONP;
 
-    else if(!strsame(name, "html"))
+    else if(!strcmp(name, "html"))
         return DATASOURCE_HTML;
 
-    else if(!strsame(name, "csv"))
+    else if(!strcmp(name, "csv"))
         return DATASOURCE_CSV;
 
-    else if(!strsame(name, "tsv-excel"))
+    else if(!strcmp(name, "tsv-excel"))
         return DATASOURCE_TSV;
 
     return DATASOURCE_JSON;
@@ -655,19 +655,19 @@ const char *group_method2string(int group) {
 
 int web_client_api_request_v1_data_group(char *name, int def)
 {
-    if(!strsame(name, "average"))
+    if(!strcmp(name, "average"))
         return GROUP_AVERAGE;
 
-    else if(!strsame(name, "min"))
+    else if(!strcmp(name, "min"))
         return GROUP_MIN;
 
-    else if(!strsame(name, "max"))
+    else if(!strcmp(name, "max"))
         return GROUP_MAX;
 
-    else if(!strsame(name, "sum"))
+    else if(!strcmp(name, "sum"))
         return GROUP_SUM;
 
-    else if(!strsame(name, "incremental-sum"))
+    else if(!strcmp(name, "incremental-sum"))
         return GROUP_INCREMENTAL_SUM;
 
     return def;
@@ -681,8 +681,8 @@ int web_client_api_request_v1_alarms(struct web_client *w, char *url)
         char *value = mystrsep(&url, "?&");
         if (!value || !*value) continue;
 
-        if(!strsame(value, "all")) all = 1;
-        else if(!strsame(value, "active")) all = 0;
+        if(!strcmp(value, "all")) all = 1;
+        else if(!strcmp(value, "active")) all = 0;
     }
 
     buffer_flush(w->response.data);
@@ -703,7 +703,7 @@ int web_client_api_request_v1_alarm_log(struct web_client *w, char *url)
         if(!name || !*name) continue;
         if(!value || !*value) continue;
 
-        if(!strsame(name, "after")) after = strtoul(value, NULL, 0);
+        if(!strcmp(name, "after")) after = strtoul(value, NULL, 0);
     }
 
     buffer_flush(w->response.data);
@@ -730,7 +730,7 @@ int web_client_api_request_single_chart(struct web_client *w, char *url, void ca
         // name and value are now the parameters
         // they are not null and not empty
 
-        if(!strsame(name, "chart")) chart = value;
+        if(!strcmp(name, "chart")) chart = value;
         //else {
         /// buffer_sprintf(w->response.data, "Unknown parameter '%s' in request.", name);
         //  goto cleanup;
@@ -786,10 +786,10 @@ int web_client_api_request_v1_allmetrics(struct web_client *w, char *url)
         if(!name || !*name) continue;
         if(!value || !*value) continue;
 
-        if(!strsame(name, "format")) {
-            if(!strsame(value, ALLMETRICS_FORMAT_SHELL))
+        if(!strcmp(name, "format")) {
+            if(!strcmp(value, ALLMETRICS_FORMAT_SHELL))
                 format = ALLMETRICS_SHELL;
-            else if(!strsame(value, ALLMETRICS_FORMAT_PROMETHEUS))
+            else if(!strcmp(value, ALLMETRICS_FORMAT_PROMETHEUS))
                 format = ALLMETRICS_PROMETHEUS;
             else
                 format = 0;
@@ -858,32 +858,32 @@ int web_client_api_request_v1_badge(struct web_client *w, char *url) {
         // name and value are now the parameters
         // they are not null and not empty
 
-        if(!strsame(name, "chart")) chart = value;
-        else if(!strsame(name, "dimension") || !strsame(name, "dim") || !strsame(name, "dimensions") || !strsame(name, "dims")) {
+        if(!strcmp(name, "chart")) chart = value;
+        else if(!strcmp(name, "dimension") || !strcmp(name, "dim") || !strcmp(name, "dimensions") || !strcmp(name, "dims")) {
             if(!dimensions)
                 dimensions = buffer_create(100);
 
             buffer_strcat(dimensions, "|");
             buffer_strcat(dimensions, value);
         }
-        else if(!strsame(name, "after")) after_str = value;
-        else if(!strsame(name, "before")) before_str = value;
-        else if(!strsame(name, "points")) points_str = value;
-        else if(!strsame(name, "group")) {
+        else if(!strcmp(name, "after")) after_str = value;
+        else if(!strcmp(name, "before")) before_str = value;
+        else if(!strcmp(name, "points")) points_str = value;
+        else if(!strcmp(name, "group")) {
             group = web_client_api_request_v1_data_group(value, GROUP_AVERAGE);
         }
-        else if(!strsame(name, "options")) {
+        else if(!strcmp(name, "options")) {
             options |= web_client_api_request_v1_data_options(value);
         }
-        else if(!strsame(name, "label")) label = value;
-        else if(!strsame(name, "units")) units = value;
-        else if(!strsame(name, "label_color")) label_color = value;
-        else if(!strsame(name, "value_color")) value_color = value;
-        else if(!strsame(name, "multiply")) multiply_str = value;
-        else if(!strsame(name, "divide")) divide_str = value;
-        else if(!strsame(name, "refresh")) refresh_str = value;
-        else if(!strsame(name, "precision")) precision_str = value;
-        else if(!strsame(name, "alarm")) alarm = value;
+        else if(!strcmp(name, "label")) label = value;
+        else if(!strcmp(name, "units")) units = value;
+        else if(!strcmp(name, "label_color")) label_color = value;
+        else if(!strcmp(name, "value_color")) value_color = value;
+        else if(!strcmp(name, "multiply")) multiply_str = value;
+        else if(!strcmp(name, "divide")) divide_str = value;
+        else if(!strcmp(name, "refresh")) refresh_str = value;
+        else if(!strcmp(name, "precision")) precision_str = value;
+        else if(!strcmp(name, "alarm")) alarm = value;
     }
 
     if(!chart || !*chart) {
@@ -924,7 +924,7 @@ int web_client_api_request_v1_badge(struct web_client *w, char *url) {
 
     int refresh = 0;
     if(refresh_str && *refresh_str) {
-        if(!strsame(refresh_str, "auto")) {
+        if(!strcmp(refresh_str, "auto")) {
             if(rc) refresh = rc->update_every;
             else if(options & RRDR_OPTION_NOT_ALIGNED)
                 refresh = st->update_every;
@@ -1121,31 +1121,31 @@ int web_client_api_request_v1_data(struct web_client *w, char *url)
         // name and value are now the parameters
         // they are not null and not empty
 
-        if(!strsame(name, "chart")) chart = value;
-        else if(!strsame(name, "dimension") || !strsame(name, "dim") || !strsame(name, "dimensions") || !strsame(name, "dims")) {
+        if(!strcmp(name, "chart")) chart = value;
+        else if(!strcmp(name, "dimension") || !strcmp(name, "dim") || !strcmp(name, "dimensions") || !strcmp(name, "dims")) {
             if(!dimensions) dimensions = buffer_create(100);
             buffer_strcat(dimensions, "|");
             buffer_strcat(dimensions, value);
         }
-        else if(!strsame(name, "after")) after_str = value;
-        else if(!strsame(name, "before")) before_str = value;
-        else if(!strsame(name, "points")) points_str = value;
-        else if(!strsame(name, "group")) {
+        else if(!strcmp(name, "after")) after_str = value;
+        else if(!strcmp(name, "before")) before_str = value;
+        else if(!strcmp(name, "points")) points_str = value;
+        else if(!strcmp(name, "group")) {
             group = web_client_api_request_v1_data_group(value, GROUP_AVERAGE);
         }
-        else if(!strsame(name, "format")) {
+        else if(!strcmp(name, "format")) {
             format = web_client_api_request_v1_data_format(value);
         }
-        else if(!strsame(name, "options")) {
+        else if(!strcmp(name, "options")) {
             options |= web_client_api_request_v1_data_options(value);
         }
-        else if(!strsame(name, "callback")) {
+        else if(!strcmp(name, "callback")) {
             responseHandler = value;
         }
-        else if(!strsame(name, "filename")) {
+        else if(!strcmp(name, "filename")) {
             outFileName = value;
         }
-        else if(!strsame(name, "tqx")) {
+        else if(!strcmp(name, "tqx")) {
             // parse Google Visualization API options
             // https://developers.google.com/chart/interactive/docs/dev/implementing_data_source
             char *tqx_name, *tqx_value;
@@ -1158,21 +1158,21 @@ int web_client_api_request_v1_data(struct web_client *w, char *url)
                 if(!tqx_name || !*tqx_name) continue;
                 if(!tqx_value || !*tqx_value) continue;
 
-                if(!strsame(tqx_name, "version"))
+                if(!strcmp(tqx_name, "version"))
                     google_version = tqx_value;
-                else if(!strsame(tqx_name, "reqId"))
+                else if(!strcmp(tqx_name, "reqId"))
                     google_reqId = tqx_value;
-                else if(!strsame(tqx_name, "sig")) {
+                else if(!strcmp(tqx_name, "sig")) {
                     google_sig = tqx_value;
                     google_timestamp = strtoul(google_sig, NULL, 0);
                 }
-                else if(!strsame(tqx_name, "out")) {
+                else if(!strcmp(tqx_name, "out")) {
                     google_out = tqx_value;
                     format = web_client_api_request_v1_data_google_format(google_out);
                 }
-                else if(!strsame(tqx_name, "responseHandler"))
+                else if(!strcmp(tqx_name, "responseHandler"))
                     responseHandler = tqx_value;
-                else if(!strsame(tqx_name, "outFileName"))
+                else if(!strcmp(tqx_name, "outFileName"))
                     outFileName = tqx_value;
             }
         }
@@ -1314,42 +1314,42 @@ int web_client_api_request_v1_registry(struct web_client *w, char *url)
 
         uint32_t hash = simple_hash(name);
 
-        if(hash == hash_action && !strsame(name, "action")) {
+        if(hash == hash_action && !strcmp(name, "action")) {
             uint32_t vhash = simple_hash(value);
 
-            if(vhash == hash_access && !strsame(value, "access")) action = 'A';
-            else if(vhash == hash_hello && !strsame(value, "hello")) action = 'H';
-            else if(vhash == hash_delete && !strsame(value, "delete")) action = 'D';
-            else if(vhash == hash_search && !strsame(value, "search")) action = 'S';
-            else if(vhash == hash_switch && !strsame(value, "switch")) action = 'W';
+            if(vhash == hash_access && !strcmp(value, "access")) action = 'A';
+            else if(vhash == hash_hello && !strcmp(value, "hello")) action = 'H';
+            else if(vhash == hash_delete && !strcmp(value, "delete")) action = 'D';
+            else if(vhash == hash_search && !strcmp(value, "search")) action = 'S';
+            else if(vhash == hash_switch && !strcmp(value, "switch")) action = 'W';
 #ifdef NETDATA_INTERNAL_CHECKS
             else error("unknown registry action '%s'", value);
 #endif /* NETDATA_INTERNAL_CHECKS */
         }
 /*
-        else if(hash == hash_redirects && !strsame(name, "redirects"))
+        else if(hash == hash_redirects && !strcmp(name, "redirects"))
             redirects = atoi(value);
 */
-        else if(hash == hash_machine && !strsame(name, "machine"))
+        else if(hash == hash_machine && !strcmp(name, "machine"))
             machine_guid = value;
 
-        else if(hash == hash_url && !strsame(name, "url"))
+        else if(hash == hash_url && !strcmp(name, "url"))
             machine_url = value;
 
         else if(action == 'A') {
-            if(hash == hash_name && !strsame(name, "name"))
+            if(hash == hash_name && !strcmp(name, "name"))
                 url_name = value;
         }
         else if(action == 'D') {
-            if(hash == hash_delete_url && !strsame(name, "delete_url"))
+            if(hash == hash_delete_url && !strcmp(name, "delete_url"))
                 delete_url = value;
         }
         else if(action == 'S') {
-            if(hash == hash_for && !strsame(name, "for"))
+            if(hash == hash_for && !strcmp(name, "for"))
                 search_machine_guid = value;
         }
         else if(action == 'W') {
-            if(hash == hash_to && !strsame(name, "to"))
+            if(hash == hash_to && !strcmp(name, "to"))
                 to_person_guid = value;
         }
 #ifdef NETDATA_INTERNAL_CHECKS
@@ -1440,31 +1440,31 @@ int web_client_api_request_v1(struct web_client *w, char *url) {
         debug(D_WEB_CLIENT, "%llu: Searching for API v1 command '%s'.", w->id, tok);
         uint32_t hash = simple_hash(tok);
 
-        if(hash == hash_data && !strsame(tok, "data"))
+        if(hash == hash_data && !strcmp(tok, "data"))
             return web_client_api_request_v1_data(w, url);
 
-        else if(hash == hash_chart && !strsame(tok, "chart"))
+        else if(hash == hash_chart && !strcmp(tok, "chart"))
             return web_client_api_request_v1_chart(w, url);
 
-        else if(hash == hash_charts && !strsame(tok, "charts"))
+        else if(hash == hash_charts && !strcmp(tok, "charts"))
             return web_client_api_request_v1_charts(w, url);
 
-        else if(hash == hash_registry && !strsame(tok, "registry"))
+        else if(hash == hash_registry && !strcmp(tok, "registry"))
             return web_client_api_request_v1_registry(w, url);
 
-        else if(hash == hash_badge && !strsame(tok, "badge.svg"))
+        else if(hash == hash_badge && !strcmp(tok, "badge.svg"))
             return web_client_api_request_v1_badge(w, url);
 
-        else if(hash == hash_alarms && !strsame(tok, "alarms"))
+        else if(hash == hash_alarms && !strcmp(tok, "alarms"))
             return web_client_api_request_v1_alarms(w, url);
 
-        else if(hash == hash_alarm_log && !strsame(tok, "alarm_log"))
+        else if(hash == hash_alarm_log && !strcmp(tok, "alarm_log"))
             return web_client_api_request_v1_alarm_log(w, url);
 
-        else if(hash == hash_alarm_variables && !strsame(tok, "alarm_variables"))
+        else if(hash == hash_alarm_variables && !strcmp(tok, "alarm_variables"))
             return web_client_api_request_v1_alarm_variables(w, url);
 
-        else if(hash == hash_raw && !strsame(tok, "allmetrics"))
+        else if(hash == hash_raw && !strcmp(tok, "allmetrics"))
             return web_client_api_request_v1_allmetrics(w, url);
 
         else {
@@ -1487,7 +1487,7 @@ int web_client_api_request(struct web_client *w, char *url)
     char *tok = mystrsep(&url, "/?&");
     if(tok && *tok) {
         debug(D_WEB_CLIENT, "%llu: Searching for API version '%s'.", w->id, tok);
-        if(strsame(tok, "v1") == 0)
+        if(strcmp(tok, "v1") == 0)
             return web_client_api_request_v1(w, url);
         else {
             buffer_flush(w->response.data);
@@ -1564,9 +1564,9 @@ int web_client_api_old_data_request(struct web_client *w, char *url, int datasou
         // parse the grouping method required
         tok = mystrsep(&url, "/");
         if(tok && *tok) {
-            if(strsame(tok, "max") == 0) group_method = GROUP_MAX;
-            else if(strsame(tok, "average") == 0) group_method = GROUP_AVERAGE;
-            else if(strsame(tok, "sum") == 0) group_method = GROUP_SUM;
+            if(strcmp(tok, "max") == 0) group_method = GROUP_MAX;
+            else if(strcmp(tok, "average") == 0) group_method = GROUP_AVERAGE;
+            else if(strcmp(tok, "sum") == 0) group_method = GROUP_SUM;
             else debug(D_WEB_CLIENT, "%llu: Unknown group method '%s'", w->id, tok);
         }
     }
@@ -1585,7 +1585,7 @@ int web_client_api_old_data_request(struct web_client *w, char *url, int datasou
     if(url) {
         // parse nonzero
         tok = mystrsep(&url, "/");
-        if(tok && *tok && strsame(tok, "nonzero") == 0) nonzero = 1;
+        if(tok && *tok && strcmp(tok, "nonzero") == 0) nonzero = 1;
     }
 
     w->response.data->contenttype = CT_APPLICATION_JSON;
@@ -1606,26 +1606,26 @@ int web_client_api_old_data_request(struct web_client *w, char *url, int datasou
             tok = mystrsep(&args, "&");
             if(tok && *tok) {
                 char *name = mystrsep(&tok, "=");
-                if(name && *name && strsame(name, "tqx") == 0) {
+                if(name && *name && strcmp(name, "tqx") == 0) {
                     char *key = mystrsep(&tok, ":");
                     char *value = mystrsep(&tok, ";");
                     if(key && value && *key && *value) {
-                        if(strsame(key, "version") == 0)
+                        if(strcmp(key, "version") == 0)
                             google_version = value;
 
-                        else if(strsame(key, "reqId") == 0)
+                        else if(strcmp(key, "reqId") == 0)
                             google_reqId = value;
 
-                        else if(strsame(key, "sig") == 0)
+                        else if(strcmp(key, "sig") == 0)
                             google_sig = value;
 
-                        else if(strsame(key, "out") == 0)
+                        else if(strcmp(key, "out") == 0)
                             google_out = value;
 
-                        else if(strsame(key, "responseHandler") == 0)
+                        else if(strcmp(key, "responseHandler") == 0)
                             google_responseHandler = value;
 
-                        else if(strsame(key, "outFileName") == 0)
+                        else if(strcmp(key, "outFileName") == 0)
                             google_outFileName = value;
                     }
                 }
@@ -1640,7 +1640,7 @@ int web_client_api_old_data_request(struct web_client *w, char *url, int datasou
             last_timestamp_in_data = strtoul(google_sig, NULL, 0);
 
             // check the client wants json
-            if(strsame(google_out, "json") != 0) {
+            if(strcmp(google_out, "json") != 0) {
                 buffer_sprintf(w->response.data,
                     "%s({version:'%s',reqId:'%s',status:'error',errors:[{reason:'invalid_query',message:'output format is not supported',detailed_message:'the format %s requested is not supported by netdata.'}]});",
                     google_responseHandler, google_version, google_reqId, google_out);
@@ -2012,11 +2012,11 @@ void web_client_process(struct web_client *w) {
                 uint32_t hash = simple_hash(tok);
                 debug(D_WEB_CLIENT, "%llu: Processing command '%s'.", w->id, tok);
 
-                if(hash == hash_api && strsame(tok, "api") == 0) {
+                if(hash == hash_api && strcmp(tok, "api") == 0) {
                     // the client is requesting api access
                     code = web_client_api_request(w, url);
                 }
-                else if(hash == hash_netdata_conf && strsame(tok, "netdata.conf") == 0) {
+                else if(hash == hash_netdata_conf && strcmp(tok, "netdata.conf") == 0) {
                     code = 200;
                     debug(D_WEB_CLIENT_ACCESS, "%llu: Sending netdata.conf ...", w->id);
 
@@ -2024,15 +2024,15 @@ void web_client_process(struct web_client *w) {
                     buffer_flush(w->response.data);
                     generate_config(w->response.data, 0);
                 }
-                else if(hash == hash_data && strsame(tok, WEB_PATH_DATA) == 0) { // "data"
+                else if(hash == hash_data && strcmp(tok, WEB_PATH_DATA) == 0) { // "data"
                     // the client is requesting rrd data -- OLD API
                     code = web_client_api_old_data_request(w, url, DATASOURCE_JSON);
                 }
-                else if(hash == hash_datasource && strsame(tok, WEB_PATH_DATASOURCE) == 0) { // "datasource"
+                else if(hash == hash_datasource && strcmp(tok, WEB_PATH_DATASOURCE) == 0) { // "datasource"
                     // the client is requesting google datasource -- OLD API
                     code = web_client_api_old_data_request(w, url, DATASOURCE_DATATABLE_JSONP);
                 }
-                else if(hash == hash_graph && strsame(tok, WEB_PATH_GRAPH) == 0) { // "graph"
+                else if(hash == hash_graph && strcmp(tok, WEB_PATH_GRAPH) == 0) { // "graph"
                     // the client is requesting an rrd graph -- OLD API
 
                     // get the name of the data to show
@@ -2063,7 +2063,7 @@ void web_client_process(struct web_client *w) {
                         buffer_strcat(w->response.data, "Graph name?\r\n");
                     }
                 }
-                else if(hash == hash_list && strsame(tok, "list") == 0) {
+                else if(hash == hash_list && strcmp(tok, "list") == 0) {
                     // OLD API
                     code = 200;
 
@@ -2075,7 +2075,7 @@ void web_client_process(struct web_client *w) {
                     for ( ; st ; st = st->next )
                         buffer_sprintf(w->response.data, "%s\n", st->name);
                 }
-                else if(hash == hash_all_json && strsame(tok, "all.json") == 0) {
+                else if(hash == hash_all_json && strcmp(tok, "all.json") == 0) {
                     // OLD API
                     code = 200;
                     debug(D_WEB_CLIENT_ACCESS, "%llu: Sending JSON list of all monitors of RRD_STATS...", w->id);
@@ -2085,7 +2085,7 @@ void web_client_process(struct web_client *w) {
                     rrd_stats_all_json(w->response.data);
                 }
 #ifdef NETDATA_INTERNAL_CHECKS
-                else if(hash == hash_exit && strsame(tok, "exit") == 0) {
+                else if(hash == hash_exit && strcmp(tok, "exit") == 0) {
                     code = 200;
                     w->response.data->contenttype = CT_TEXT_PLAIN;
                     buffer_flush(w->response.data);
@@ -2098,7 +2098,7 @@ void web_client_process(struct web_client *w) {
                     error("web request to exit received.");
                     netdata_cleanup_and_exit(0);
                 }
-                else if(hash == hash_debug && strsame(tok, "debug") == 0) {
+                else if(hash == hash_debug && strcmp(tok, "debug") == 0) {
                     buffer_flush(w->response.data);
 
                     // get the name of the data to show
@@ -2130,7 +2130,7 @@ void web_client_process(struct web_client *w) {
                         buffer_strcat(w->response.data, "debug which chart?\r\n");
                     }
                 }
-                else if(hash == hash_mirror && strsame(tok, "mirror") == 0) {
+                else if(hash == hash_mirror && strcmp(tok, "mirror") == 0) {
                     code = 200;
 
                     debug(D_WEB_CLIENT_ACCESS, "%llu: Mirroring...", w->id);
index 20b25f0aa7b30c9a87ed58e2a57b4b76b716c84c..8e942a59d549e8dc380447de1f2f5f1753fa1305 100644 (file)
@@ -256,7 +256,7 @@ static inline int bind_to_one(const char *definition, int default_port, int list
         *e = '\0';
     }
 
-    if(!*ip || *ip == '*' || !strsame(ip, "any") || !strsame(ip, "all"))
+    if(!*ip || *ip == '*' || !strcmp(ip, "any") || !strcmp(ip, "all"))
         ip = NULL;
     if(!*port)
         port = buffer2;