Code

Merge branch 'ssnprintf-cleanup'
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Sun, 16 Jul 2017 20:33:21 +0000 (22:33 +0200)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Sun, 16 Jul 2017 20:33:21 +0000 (22:33 +0200)
Conflicts:
src/dpdkevents.c
src/utils_dpdk.c
src/write_mongodb.c

13 files changed:
1  2 
src/apache.c
src/ascent.c
src/bind.c
src/curl.c
src/curl_json.c
src/curl_xml.c
src/dpdkevents.c
src/dpdkstat.c
src/nginx.c
src/snmp_agent.c
src/utils_dpdk.c
src/write_http.c
src/write_mongodb.c

diff --cc src/apache.c
Simple merge
diff --cc src/ascent.c
Simple merge
diff --cc src/bind.c
Simple merge
diff --cc src/curl.c
Simple merge
diff --cc src/curl_json.c
Simple merge
diff --cc src/curl_xml.c
Simple merge
Simple merge
diff --cc src/dpdkstat.c
Simple merge
diff --cc src/nginx.c
Simple merge
Simple merge
index 4f9243ea03d3b5d5198fb0a5d1bbf8749eae5dee,4b246c9ecb870b19c2d9d3d588346556776c1ffe..77f596ebd7da7352efcb4e1d76b550505a80c61c
@@@ -103,10 -103,11 +103,10 @@@ static void dpdk_helper_config_default(
  
    DPDK_HELPER_TRACE(phc->shm_name);
  
-   ssnprintf(phc->eal_config.coremask, DATA_MAX_NAME_LEN, "%s", "0xf");
-   ssnprintf(phc->eal_config.memory_channels, DATA_MAX_NAME_LEN, "%s", "1");
-   ssnprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN, "%s",
-             DPDK_DEFAULT_RTE_CONFIG);
+   snprintf(phc->eal_config.coremask, DATA_MAX_NAME_LEN, "%s", "0xf");
+   snprintf(phc->eal_config.memory_channels, DATA_MAX_NAME_LEN, "%s", "1");
 -  snprintf(phc->eal_config.process_type, DATA_MAX_NAME_LEN, "%s", "secondary");
+   snprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN, "%s",
+            DPDK_DEFAULT_RTE_CONFIG);
  }
  
  int dpdk_helper_eal_config_set(dpdk_helper_ctx_t *phc, dpdk_eal_config_t *ec) {
@@@ -176,15 -176,15 +176,15 @@@ int dpdk_helper_eal_config_parse(dpdk_h
        status = cf_util_get_string_buffer(child, phc->eal_config.socket_memory,
                                           sizeof(phc->eal_config.socket_memory));
        DEBUG("dpdk_common: EAL:Socket memory %s", phc->eal_config.socket_memory);
 -    } else if (strcasecmp("ProcessType", child->key) == 0) {
 -      status = cf_util_get_string_buffer(child, phc->eal_config.process_type,
 -                                         sizeof(phc->eal_config.process_type));
 -      DEBUG("dpdk_common: EAL:Process type %s", phc->eal_config.process_type);
 -    } else if ((strcasecmp("FilePrefix", child->key) == 0) &&
 -               (child->values[0].type == OCONFIG_TYPE_STRING)) {
 -      snprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN,
 -               "/var/run/.%s_config", child->values[0].value.string);
 -      DEBUG("dpdk_common: EAL:File prefix %s", phc->eal_config.file_prefix);
 +    } else if (strcasecmp("FilePrefix", child->key) == 0) {
 +      char prefix[DATA_MAX_NAME_LEN];
 +
 +      status = cf_util_get_string_buffer(child, prefix, sizeof(prefix));
 +      if (status == 0) {
-         ssnprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN,
++        snprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN,
 +                  "/var/run/.%s_config", prefix);
 +        DEBUG("dpdk_common: EAL:File prefix %s", phc->eal_config.file_prefix);
 +      }
      } else {
        ERROR("dpdk_common: Invalid '%s' configuration option", child->key);
        status = -EINVAL;
Simple merge
index e1fb41fd9a500ee210bc3f91c630c05d0c8d79a3,37e34098f1769e73fb84128e287dfe23f357249f..46b6d865be2d569a76b56c28f8b44c4d3d347b5f
@@@ -93,10 -93,10 +93,10 @@@ static bson_t *wm_create_bson(const dat
    BSON_APPEND_UTF8(ret, "type_instance", vl->type_instance);
  
    BSON_APPEND_ARRAY_BEGIN(ret, "values", &subarray); /* {{{ */
 -  for (int i = 0; i < ds->ds_num; i++) {
 +  for (size_t i = 0; i < ds->ds_num; i++) {
      char key[16];
  
-     ssnprintf(key, sizeof(key), "%zu", i);
 -    snprintf(key, sizeof(key), "%i", i);
++    snprintf(key, sizeof(key), "%zu", i);
  
      if (ds->ds[i].type == DS_TYPE_GAUGE)
        BSON_APPEND_DOUBLE(&subarray, key, vl->values[i].gauge);
    bson_append_array_end(ret, &subarray); /* }}} values */
  
    BSON_APPEND_ARRAY_BEGIN(ret, "dstypes", &subarray); /* {{{ */
 -  for (int i = 0; i < ds->ds_num; i++) {
 +  for (size_t i = 0; i < ds->ds_num; i++) {
      char key[16];
  
-     ssnprintf(key, sizeof(key), "%zu", i);
 -    snprintf(key, sizeof(key), "%i", i);
++    snprintf(key, sizeof(key), "%zu", i);
  
      if (store_rates)
        BSON_APPEND_UTF8(&subarray, key, "gauge");
    bson_append_array_end(ret, &subarray); /* }}} dstypes */
  
    BSON_APPEND_ARRAY_BEGIN(ret, "dsnames", &subarray); /* {{{ */
 -  for (int i = 0; i < ds->ds_num; i++) {
 +  for (size_t i = 0; i < ds->ds_num; i++) {
      char key[16];
  
-     ssnprintf(key, sizeof(key), "%zu", i);
 -    snprintf(key, sizeof(key), "%i", i);
++    snprintf(key, sizeof(key), "%zu", i);
      BSON_APPEND_UTF8(&subarray, key, ds->ds[i].name);
    }
    bson_append_array_end(ret, &subarray); /* }}} dsnames */