comparison util.c @ 700:f3ec1cb11cea

Trim whitespace.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 17 Jan 2020 20:03:41 +0200
parents ceb73b712121
children 93d0e1547842
comparison
equal deleted inserted replaced
699:e9232ce52bf8 700:f3ec1cb11cea
35 { 35 {
36 size_t pos; 36 size_t pos;
37 37
38 for (pos = strlen(buf) - 1; pos > 0 && th_isspace(buf[pos]); pos--) 38 for (pos = strlen(buf) - 1; pos > 0 && th_isspace(buf[pos]); pos--)
39 buf[pos] = 0; 39 buf[pos] = 0;
40 40
41 return buf; 41 return buf;
42 } 42 }
43 43
44 44
45 int str_compare(const void *s1, const void *s2) 45 int str_compare(const void *s1, const void *s2)
465 { 465 {
466 /* 466 /*
467 int n = 0; 467 int n = 0;
468 const uint8_t *c = (uint8_t *)name; 468 const uint8_t *c = (uint8_t *)name;
469 uint8_t hash = 0xff; 469 uint8_t hash = 0xff;
470 470
471 while (*c && n < 4) 471 while (*c && n < 4)
472 { 472 {
473 hash = (hash << 1) ^ tolower(*c); 473 hash = (hash << 1) ^ tolower(*c);
474 c++; n++; 474 c++; n++;
475 } 475 }
476 476
477 return (hash & 0xff); 477 return (hash & 0xff);
478 */ 478 */
479 return (uint8_t) tolower(name[0]); 479 return (uint8_t) tolower(name[0]);
480 } 480 }
481 481