summaryrefslogtreecommitdiffstats
path: root/pcp
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2023-11-23 12:22:02 +0100
committerBenBE <BenBE@geshi.org>2023-12-26 15:14:19 +0100
commit6aa9ef2726e42c4ae062b55be4d5cc015767d997 (patch)
treed5bd033946b404fa99b70b0b1c560725cef302bf /pcp
parenta98fc47ffe67e88b1a83f94382795b8787a9bfe8 (diff)
Fix code style
Diffstat (limited to 'pcp')
-rw-r--r--pcp/Instance.c2
-rw-r--r--pcp/Instance.h6
-rw-r--r--pcp/PCPDynamicColumn.c6
-rw-r--r--pcp/PCPDynamicMeter.c4
-rw-r--r--pcp/PCPDynamicScreen.c6
-rw-r--r--pcp/PCPDynamicScreen.h2
-rw-r--r--pcp/PCPProcessTable.c8
-rw-r--r--pcp/Platform.c7
8 files changed, 24 insertions, 17 deletions
diff --git a/pcp/Instance.c b/pcp/Instance.c
index f915350d..8ae90512 100644
--- a/pcp/Instance.c
+++ b/pcp/Instance.c
@@ -66,7 +66,7 @@ static void Instance_writeField(const Row* super, RichString* str, RowField fiel
return;
pmAtomValue atom;
- pmAtomValue *ap = &atom;
+ pmAtomValue* ap = &atom;
const pmDesc* descp = Metric_desc(cp->id);
if (!Metric_instance(cp->id, instid, this->offset, ap, descp->type))
ap = NULL;
diff --git a/pcp/Instance.h b/pcp/Instance.h
index c7d688fc..aefd6426 100644
--- a/pcp/Instance.h
+++ b/pcp/Instance.h
@@ -17,16 +17,16 @@ in the source distribution for its full text.
typedef struct Instance_ {
Row super;
- char *name; /* external instance name */
+ char* name; /* external instance name */
const struct InDomTable_* indom; /* instance domain */
/* default result offset to use for searching metrics with instances */
unsigned int offset;
} Instance;
-#define InDom_getId(i_) ((i_)->indom->id)
+#define InDom_getId(i_) ((i_)->indom->id)
#define Instance_getId(i_) ((i_)->super.id)
-#define Instance_setId(i_, id_) ((i_)->super.id = (id_))
+#define Instance_setId(i_, id_) ((i_)->super.id = (id_))
extern const RowClass Instance_class;
diff --git a/pcp/PCPDynamicColumn.c b/pcp/PCPDynamicColumn.c
index 534a9ba6..b0bd03e1 100644
--- a/pcp/PCPDynamicColumn.c
+++ b/pcp/PCPDynamicColumn.c
@@ -273,7 +273,7 @@ static void PCPDynamicColumn_setupWidth(ATTR_UNUSED ht_key_t key, void* value, A
if (column->instances || desc->type == PM_TYPE_STRING) {
column->super.width = column->width;
if (column->super.width == 0)
- column->super.width = -16;
+ column->super.width = -16;
return;
}
@@ -348,6 +348,7 @@ static int PCPDynamicColumn_normalize(const pmDesc* desc, const pmAtomValue* ap,
default:
return PM_ERR_CONV;
}
+
return 0;
}
@@ -460,7 +461,7 @@ void PCPDynamicColumn_writeField(PCPDynamicColumn* this, const Process* proc, Ri
pid_t pid = Process_getPid(proc);
pmAtomValue atom;
- pmAtomValue *ap = &atom;
+ pmAtomValue* ap = &atom;
if (!Metric_instance(this->id, pid, pp->offset, ap, desc->type))
ap = NULL;
@@ -510,5 +511,6 @@ int PCPDynamicColumn_compareByKey(const PCPProcess* p1, const PCPProcess* p2, Pr
default:
break;
}
+
return -1;
}
diff --git a/pcp/PCPDynamicMeter.c b/pcp/PCPDynamicMeter.c
index 1e118351..11df5f0a 100644
--- a/pcp/PCPDynamicMeter.c
+++ b/pcp/PCPDynamicMeter.c
@@ -382,9 +382,11 @@ void PCPDynamicMeter_updateValues(PCPDynamicMeter* this, Meter* meter) {
default:
break;
}
+
if (saved != bytes && metric->suffix)
bytes += xSnprintf(buffer + bytes, size - bytes, "%s", metric->suffix);
}
+
if (!bytes)
xSnprintf(buffer, size, "no data");
}
@@ -458,12 +460,14 @@ void PCPDynamicMeter_display(PCPDynamicMeter* this, ATTR_UNUSED const Meter* met
default:
break;
}
+
if (len) {
RichString_appendnAscii(out, CRT_colors[metric->color], buffer, len);
if (metric->suffix)
RichString_appendAscii(out, CRT_colors[METER_TEXT], metric->suffix);
}
}
+
if (nodata)
RichString_writeAscii(out, CRT_colors[METER_VALUE_ERROR], "no data");
}
diff --git a/pcp/PCPDynamicScreen.c b/pcp/PCPDynamicScreen.c
index a66d9dce..22228225 100644
--- a/pcp/PCPDynamicScreen.c
+++ b/pcp/PCPDynamicScreen.c
@@ -42,7 +42,7 @@ static char* formatFields(PCPDynamicScreen* screen) {
static void PCPDynamicScreens_appendDynamicColumns(PCPDynamicScreens* screens, PCPDynamicColumns* columns) {
for (size_t i = 0; i < screens->count; i++) {
- PCPDynamicScreen *screen = Hashtable_get(screens->table, i);
+ PCPDynamicScreen* screen = Hashtable_get(screens->table, i);
if (!screen)
return;
@@ -60,7 +60,7 @@ static void PCPDynamicScreens_appendDynamicColumns(PCPDynamicScreens* screens, P
if (j == 0) {
const pmDesc* desc = Metric_desc(column->id);
- assert(desc->indom != PM_INDOM_NULL);
+ assert(desc->indom != PM_INDOM_NULL);
screen->indom = desc->indom;
screen->key = column->id;
}
@@ -241,7 +241,7 @@ static void PCPDynamicScreen_parseFile(PCPDynamicScreens* screens, const char* p
if (ok)
screen = PCPDynamicScreen_new(screens, key + 1);
if (pmDebugOptions.appl0)
- fprintf(stderr, "[%s] screen: %s\n", path, key+1);
+ fprintf(stderr, "[%s] screen: %s\n", path, key + 1);
} else if (!ok) {
; /* skip this one, we're looking for a new header */
} else if (!value || !screen) {
diff --git a/pcp/PCPDynamicScreen.h b/pcp/PCPDynamicScreen.h
index 73535925..62483941 100644
--- a/pcp/PCPDynamicScreen.h
+++ b/pcp/PCPDynamicScreen.h
@@ -25,7 +25,7 @@ struct PCPDynamicColumns_;
typedef struct PCPDynamicScreen_ {
DynamicScreen super;
- struct InDomTable_ *table;
+ struct InDomTable_* table;
struct PCPDynamicColumn_** columns;
size_t totalColumns;
diff --git a/pcp/PCPProcessTable.c b/pcp/PCPProcessTable.c
index 07d5805d..4999bdc2 100644
--- a/pcp/PCPProcessTable.c
+++ b/pcp/PCPProcessTable.c
@@ -333,7 +333,7 @@ static void PCPProcessTable_updateCmdline(Process* process, int pid, int offset,
tokenStart = i + 1;
/* special-case arguments for problematic situations like "find /" */
if (command[i] <= ' ')
- argSepSpace = true;
+ argSepSpace = true;
}
tokenEnd = length;
if (argSepSpace)
@@ -403,10 +403,10 @@ static bool PCPProcessTable_updateProcesses(PCPProcessTable* this) {
PCPProcessTable_updateMemory(pp, pid, offset);
- if ((flags & PROCESS_FLAG_LINUX_SMAPS) &&
- (Process_isKernelThread(proc) == false)) {
- if (Metric_enabled(PCP_PROC_SMAPS_PSS))
+ if ((flags & PROCESS_FLAG_LINUX_SMAPS) && !Process_isKernelThread(proc)) {
+ if (Metric_enabled(PCP_PROC_SMAPS_PSS)) {
PCPProcessTable_updateSmaps(pp, pid, offset);
+ }
}
char command[MAX_NAME + 1];
diff --git a/pcp/Platform.c b/pcp/Platform.c
index 6fc2fc51..0b5f3344 100644
--- a/pcp/Platform.c
+++ b/pcp/Platform.c
@@ -802,7 +802,7 @@ CommandLineStatus Platform_getLongOption(int opt, ATTR_UNUSED int argc, char** a
case PLATFORM_LONGOPT_HOST: /* --host=HOSTSPEC */
if (argv[optind][0] == '\0')
return STATUS_ERROR_EXIT;
- __pmAddOptHost(&opts, optarg);
+ __pmAddOptHost(&opts, optarg);
return STATUS_OK;
case PLATFORM_LONGOPT_HOSTZONE: /* --hostzone */
@@ -828,6 +828,7 @@ CommandLineStatus Platform_getLongOption(int opt, ATTR_UNUSED int argc, char** a
default:
break;
}
+
return STATUS_ERROR_EXIT;
}
@@ -918,6 +919,6 @@ void Platform_addDynamicScreenAvailableColumns(Panel* availableColumns, const ch
}
void Platform_updateTables(Machine* host) {
- PCPDynamicScreen_appendTables(&pcp->screens, host);
- PCPDynamicColumns_setupWidths(&pcp->columns);
+ PCPDynamicScreen_appendTables(&pcp->screens, host);
+ PCPDynamicColumns_setupWidths(&pcp->columns);
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy