1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-26 12:27:52 +00:00

Made various misc.cc functions more concise

This commit is contained in:
AlexApps99 2020-01-30 19:30:52 +13:00 committed by Brenden Matthews
parent 8dc04f3902
commit 9bee2eec39

View File

@ -88,14 +88,12 @@ void print_catp(struct text_object *obj, char *p, unsigned int p_max_size) {
void print_startcase(struct text_object *obj, char *p,
unsigned int p_max_size) {
evaluate(obj->data.s, p, p_max_size);
for (unsigned int x = 0, z = 0; x < p_max_size - 1 && p[x]; x++) {
if (isspace(p[x])) {
z = 0;
} else if (z == 0) {
p[x] = toupper(p[x]);
z++;
} else {
p[x] = tolower(p[x]);
p[x] = z ? tolower(p[x]) : toupper(p[x]);
z++;
}
}
@ -104,17 +102,17 @@ void print_startcase(struct text_object *obj, char *p,
void print_lowercase(struct text_object *obj, char *p,
unsigned int p_max_size) {
evaluate(obj->data.s, p, p_max_size);
for (unsigned int x = 0; x < p_max_size - 1 && p[x]; x++) {
for (unsigned int x = 0; x < p_max_size - 1 && p[x]; x++)
p[x] = tolower(p[x]);
}
}
void print_uppercase(struct text_object *obj, char *p,
unsigned int p_max_size) {
evaluate(obj->data.s, p, p_max_size);
for (unsigned int x = 0; x < p_max_size - 1 && p[x]; x++) {
for (unsigned int x = 0; x < p_max_size - 1 && p[x]; x++)
p[x] = toupper(p[x]);
}
}
void strip_trailing_whitespace(struct text_object *obj, char *p,