diff options
| -rw-r--r-- | hardinfo/vendor.c | 9 | ||||
| -rw-r--r-- | includes/vendor.h | 2 | 
2 files changed, 6 insertions, 5 deletions
| diff --git a/hardinfo/vendor.c b/hardinfo/vendor.c index 86705e10..f73781c3 100644 --- a/hardinfo/vendor.c +++ b/hardinfo/vendor.c @@ -121,11 +121,12 @@ static GSList *vendor_list = NULL;  /* sort the vendor list by length of match_string,   * LONGEST first */  gint vendor_sort (gconstpointer a, gconstpointer b) { +    const Vendor *ap = a, *bp = b;      int la = 0, lb = 0; -    if (a) la = strlen(a); -    if (b) lb = strlen(b); -    if (a == b) return 0; -    if (a > b) return -1; +    if (ap && ap->match_string) la = strlen(ap->match_string); +    if (bp && bp->match_string) lb = strlen(bp->match_string); +    if (la == lb) return 0; +    if (la > lb) return -1;      return 1;  } diff --git a/includes/vendor.h b/includes/vendor.h index 21d52562..021f4e78 100644 --- a/includes/vendor.h +++ b/includes/vendor.h @@ -22,7 +22,7 @@  typedef struct _Vendor	Vendor;  struct _Vendor {    char *match_string; -  int match_case; /* 0 = ignore case, 1 = match case*/ +  int match_case; /* 0 = ignore case, 1 = match case */    char *name;    char *url;  }; | 
