diff options
Diffstat (limited to 'hardinfo')
| -rw-r--r-- | hardinfo/dt_util.c | 30 | ||||
| -rw-r--r-- | hardinfo/gpu_util.c | 16 | ||||
| -rw-r--r-- | hardinfo/info.c | 3 | ||||
| -rw-r--r-- | hardinfo/vendor.c | 12 | 
4 files changed, 19 insertions, 42 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; -} - diff --git a/hardinfo/gpu_util.c b/hardinfo/gpu_util.c index 17c79a73..6bf2ac2d 100644 --- a/hardinfo/gpu_util.c +++ b/hardinfo/gpu_util.c @@ -20,7 +20,7 @@  #include "hardinfo.h"  #include "gpu_util.h" - +#include "nice_name.h"  #include "cpu_util.h" /* for EMPIFNULL() */  nvgpu *nvgpu_new() { @@ -229,14 +229,12 @@ static void make_nice_name(gpud *s) {      /* try and a get a "short name" for the vendor */      vendor_str = vendor_get_shortest_name(vendor_str); -    /* These two former special cases are currently handled by the vendor_get_shortest_name() -     * function well enough, but the notes are preserved here. */ -        /* nvidia PCI strings are pretty nice already, -         * just shorten the company name */ -        // s->nice_name = g_strdup_printf("%s %s", "nVidia", device_str); -        /* Intel Graphics may have very long names, like "Intel Corporation Seventh Generation Something Core Something Something Integrated Graphics Processor Revision Ninety-four" -         * but for now at least shorten "Intel Corporation" to just "Intel" */ -        // s->nice_name = g_strdup_printf("%s %s", "Intel", device_str); +    if (strstr(vendor_str, "Intel")) { +        gchar *device_str_clean = strdup(device_str); +        nice_name_intel_gpu_device(device_str_clean); +        s->nice_name = g_strdup_printf("%s %s", vendor_str, device_str_clean); +        g_free(device_str_clean); +    }      if (strstr(vendor_str, "AMD")) {          /* AMD PCI strings are crazy stupid because they use the exact same diff --git a/hardinfo/info.c b/hardinfo/info.c index ac18e0d9..cf6af9f9 100644 --- a/hardinfo/info.c +++ b/hardinfo/info.c @@ -17,6 +17,7 @@   */  #include "hardinfo.h" +#include "util_sysobj.h" /* for SEQ() */  /* Using a slightly modified gg_key_file_parse_string_as_value()   * from GLib in flatten(), to escape characters and the separator. @@ -377,8 +378,6 @@ gchar *info_flatten(struct Info *info)      return g_string_free(values, FALSE);  } -#define SEQ(a,b) (g_strcmp0(a,b) == 0) -  struct InfoField *info_find_field(struct Info *info, const gchar *tag, const gchar *name) {      struct InfoGroup *group;      struct InfoField *field; diff --git a/hardinfo/vendor.c b/hardinfo/vendor.c index bd2642d8..5df57c52 100644 --- a/hardinfo/vendor.c +++ b/hardinfo/vendor.c @@ -26,9 +26,7 @@  #include "config.h"  #include "hardinfo.h"  #include "strstr_word.h" - -#include "dt_util.h" /* for appf() */ -#define SEQ(a,b) (g_strcmp0(a,b) == 0) +#include "util_sysobj.h" /* for appfsp() and SEQ() */  /* { match_string, match_rule, name, url } */  static Vendor vendors_builtin[] = { @@ -347,14 +345,14 @@ const Vendor *vendor_match(const gchar *id_str, ...) {      if (id_str) {          c++;          tl += strlen(id_str); -        tmp = appf(tmp, "%s", id_str); +        tmp = appfsp(tmp, "%s", id_str);          va_start(ap, id_str);          p = va_arg(ap, gchar*);          while(p) {              c++;              tl += strlen(p); -            tmp = appf(tmp, "%s", p); +            tmp = appfsp(tmp, "%s", p);              p = va_arg(ap, gchar*);          }          va_end(ap); @@ -506,14 +504,14 @@ vendor_list vendors_match(const gchar *id_str, ...) {      if (id_str) {          c++;          tl += strlen(id_str); -        tmp = appf(tmp, "%s", id_str); +        tmp = appfsp(tmp, "%s", id_str);          va_start(ap, id_str);          p = va_arg(ap, gchar*);          while(p) {              c++;              tl += strlen(p); -            tmp = appf(tmp, "%s", p); +            tmp = appfsp(tmp, "%s", p);              p = va_arg(ap, gchar*);          }          va_end(ap);  | 
