aboutsummaryrefslogtreecommitdiff
path: root/hardinfo/dt_util.c
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2019-08-09 12:54:10 -0500
committerLeandro A. F. Pereira <leandro@hardinfo.org>2019-08-10 16:47:44 -0700
commit39db0d3af0ff9f7c55cdee988733fb0b3c0023c4 (patch)
treefebc121a6cb1038af5e5cd907b0ff029efd9a25a /hardinfo/dt_util.c
parent44841ef5d06a6c7d0e22491901afc067228f7e64 (diff)
name cleanup for x86 model strings and intel pci device strings
x86 CPU: * Remove (R), (TM), etc * AMD: remove redundant "X2 Dual Core", "X4 Quad Core", etc * Move vendor to front if not already * Remove speed, as the actual speed is usually right next to it * Remove "CPU", "APU", "Processor" to shorten * Compress space Intel GPU: * Remove (R) * Abbreviate "Generation": "Gen" * Remove "Processor", "Controller", and "Device" to shorten * Compress space Some examples: x86 CPU: 'AMD Turion(tm) 64 Mobile Technology ML-32' ---> 'AMD Turion 64 Mobile ML-32' 'Cyrix MediaGXtm MMXtm Enhanced' ---> 'Cyrix MediaGX MMX Enhanced' 'Transmeta(tm) Crusoe(tm) Processor TM5800' ---> 'Transmeta Crusoe TM5800' 'VIA Nano X2 L4350 @ 1.6+ GHz' ---> 'VIA Nano X2 L4350' 'AMD Athlon(tm) 64 X2 Dual-Core Processor TK-53' ---> 'AMD Athlon 64 X2 TK-53' 'Embedded AMD Opteron(tm) Processor 23KS EE' ---> 'AMD Embedded Opteron 23KS EE' 'Intel(R) Atom(TM) x5-Z8300 CPU @ 1.44GHz' ---> 'Intel Atom x5-Z8300' 'Intel(R) Pentium(R) III CPU - S 1400MHz' ---> 'Intel Pentium III - S' 'Dual Core AMD Opteron(tm) Processor 165' ---> 'AMD Dual Core Opteron 165' 'Genuine Intel(R) CPU T1350 @ 1.86GHz' ---> 'Intel T1350' 'AMD Phenom(tm) 9350e Quad-Core Processor' ---> 'AMD Phenom 9350e Quad-Core' Intel GPU: 'Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller' ---> 'Atom/Celeron/Pentium x5-E8000/J3xxx/N3xxx Integrated Graphics' '4th Generation Core Processor Family Integrated Graphics Controller' ---> '4th Gen Core Family Integrated Graphics' 'Mobile GM965/GL960 Integrated Graphics Controller (secondary)' ---> 'Mobile GM965/GL960 Integrated Graphics (secondary)' 'Mobile 915GM/GMS/910GML Express Graphics Controller' ---> 'Mobile 915GM/GMS/910GML Express Graphics' Also: Fix/replace the appf() and SEQ() that were peppered about. Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'hardinfo/dt_util.c')
-rw-r--r--hardinfo/dt_util.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/hardinfo/dt_util.c b/hardinfo/dt_util.c
index da38fd91..2d1b60a0 100644
--- a/hardinfo/dt_util.c
+++ b/hardinfo/dt_util.c
@@ -27,6 +27,7 @@
#include <endian.h>
#include "hardinfo.h"
#include "dt_util.h"
+#include "appf.h"
static struct {
char *name; int type;
@@ -682,14 +683,14 @@ char *dtr_list_override(dtr_obj *obj) {
src += 4; consumed += 4;
l = strlen(src) + 1; /* consume the null */
str = dtr_list_str0(src, l);
- ret = appf(ret, "<%s -> %s>", ph, str);
+ ret = appfsp(ret, "<%s -> %s>", ph, str);
src += l; consumed += l;
free(ph);
free(str);
}
if (consumed < obj->length) {
str = dtr_list_byte((uint8_t*)src, obj->length - consumed);
- ret = appf(ret, "%s", str);
+ ret = appfsp(ret, "%s", str);
free(str);
}
return ret;
@@ -720,7 +721,7 @@ char *dtr_list_phref(dtr_obj *obj, char *ext_cell_prop) {
ph = dtr_elem_phref(obj->dt, obj->data_int[i], 0, NULL); i++;
if (ext_cells > count - i) ext_cells = count - i;
ext = dtr_list_hex((obj->data_int + i), ext_cells); i+=ext_cells;
- ret = appf(ret, "<%s%s%s>",
+ ret = appfsp(ret, "<%s%s%s>",
ph, (ext_cells) ? " " : "", ext);
g_free(ph);
g_free(ext);
@@ -748,7 +749,7 @@ char *dtr_list_interrupts(dtr_obj *obj) {
while (i < count) {
icells = UMIN(icells, count - i);
ext = dtr_list_hex((obj->data_int + i), icells); i+=icells;
- ret = appf(ret, "<%s>", ext);
+ ret = appfsp(ret, "<%s>", ext);
}
return ret;
@@ -782,7 +783,7 @@ char *dtr_list_reg(dtr_obj *obj) {
consumed = 0;
while (consumed + (tup_len * 4) <= obj->length) {
tup_str = dtr_list_hex(next, tup_len);
- ret = appf(ret, "<%s>", tup_str);
+ ret = appfsp(ret, "<%s>", tup_str);
free(tup_str);
consumed += (tup_len * 4);
next += tup_len;
@@ -1184,22 +1185,3 @@ char *dtr_maps_info(dtr *s) {
g_free(sy_map);
return ret;
}
-
-char *appf(char *src, char *fmt, ...) {
- gchar *buf, *ret;
- va_list args;
-
- va_start(args, fmt);
- buf = g_strdup_vprintf(fmt, args);
- va_end(args);
-
- if (src != NULL) {
- ret = g_strdup_printf("%s%s%s", src, sp_sep(src), buf);
- g_free(buf);
- g_free(src);
- } else
- ret = buf;
-
- return ret;
-}
-