#include "graph.h"
#include "graph-bus.h"
+#include "string.h"
static int collecty_graph_node_enumerator(sd_bus* bus,
const char* path, void* data, char*** nodes, sd_bus_error* error) {
goto ERROR;
// Parse "format"
- if (strcmp(key, "format") == 0) {
+ if (collecty_string_equals(key, "format")) {
r = sd_bus_message_read(m, "v", "s", &options.format);
if (r < 0)
goto ERROR;
// Parse "height"
- } else if (strcmp(key, "height") == 0) {
+ } else if (collecty_string_equals(key, "height")) {
r = sd_bus_message_read(m, "v", "t", &options.dimensions.h);
if (r < 0)
goto ERROR;
// Parse "width"
- } else if (strcmp(key, "width") == 0) {
+ } else if (collecty_string_equals(key, "width")) {
r = sd_bus_message_read(m, "v", "t", &options.dimensions.w);
if (r < 0)
goto ERROR;
v *= 1024;
// Store the values
- if (strcmp("MemTotal:", k) == 0)
+ if (collecty_string_equals("MemTotal:", k))
meminfo->mem_total = v;
- else if (strcmp("MemFree:", k) == 0)
+ else if (collecty_string_equals("MemFree:", k))
meminfo->mem_free = v;
- else if (strcmp("MemAvailable:", k) == 0)
+ else if (collecty_string_equals("MemAvailable:", k))
meminfo->mem_available = v;
- else if (strcmp("Cached:", k) == 0)
+ else if (collecty_string_equals("Cached:", k))
meminfo->cached = v;
- else if (strcmp("Buffers:", k) == 0)
+ else if (collecty_string_equals("Buffers:", k))
meminfo->buffers = v;
- else if (strcmp("Active:", k) == 0)
+ else if (collecty_string_equals("Active:", k))
meminfo->active = v;
- else if (strcmp("Inactive:", k) == 0)
+ else if (collecty_string_equals("Inactive:", k))
meminfo->inactive = v;
- else if (strcmp("Active(anon):", k) == 0)
+ else if (collecty_string_equals("Active(anon):", k))
meminfo->active_anon = v;
- else if (strcmp("Inactive(anon):", k) == 0)
+ else if (collecty_string_equals("Inactive(anon):", k))
meminfo->inactive_anon = v;
- else if (strcmp("Active(file):", k) == 0)
+ else if (collecty_string_equals("Active(file):", k))
meminfo->active_file = v;
- else if (strcmp("Inactive(file):", k) == 0)
+ else if (collecty_string_equals("Inactive(file):", k))
meminfo->inactive_file = v;
- else if (strcmp("SwapTotal:", k) == 0)
+ else if (collecty_string_equals("SwapTotal:", k))
meminfo->swap_total = v;
- else if (strcmp("SwapFree:", k) == 0)
+ else if (collecty_string_equals("SwapFree:", k))
meminfo->swap_free = v;
- else if (strcmp("Shmem:", k) == 0)
+ else if (collecty_string_equals("Shmem:", k))
meminfo->shmem = v;
- else if (strcmp("Slab:", k) == 0)
+ else if (collecty_string_equals("Slab:", k))
meminfo->slab = v;
- else if (strcmp("SReclaimable:", k) == 0)
+ else if (collecty_string_equals("SReclaimable:", k))
meminfo->sreclaimable = v;
- else if (strcmp("SUnreclaim:", k) == 0)
+ else if (collecty_string_equals("SUnreclaim:", k))
meminfo->sunreclaim = v;
}
t = strtok_r(line, " ", &p);
// If the first token does not match the tag, we skip the line
- if (strcmp(tag, t) != 0)
+ if (!collecty_string_equals(tag, t))
return 0;
// Read all tokens