Replaced two strstr by a hand-written loop in this critical code.
2007-01-11 Benoît Dejean <benoit@placenet.org> * glibtop_private.c: (get_scaled): Replaced two strstr by a hand-written loop in this critical code. svn path=/trunk/; revision=2544
This commit is contained in:
committed by
Benoît Dejean
parent
63fb94127a
commit
b411ee115f
@@ -1,3 +1,9 @@
|
||||
2007-01-11 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* glibtop_private.c: (get_scaled):
|
||||
|
||||
Replaced two strstr by a hand-written loop in this critical code.
|
||||
|
||||
2006-09-11 Benoît Dejean <benoit@placenet.org>
|
||||
|
||||
* procmap.c: (glibtop_get_proc_map_s):
|
||||
|
@@ -25,10 +25,16 @@ get_scaled(const char *buffer, const char *key)
|
||||
{
|
||||
ptr += strlen(key);
|
||||
value = strtoull(ptr, &next, 0);
|
||||
if (strchr(next, 'k'))
|
||||
value *= 1024;
|
||||
else if (strchr(next, 'M'))
|
||||
value *= 1024 * 1024;
|
||||
|
||||
for ( ; *next; ++next) {
|
||||
if (*next == 'k') {
|
||||
value *= 1024;
|
||||
break;
|
||||
} else if (*next == 'M') {
|
||||
value *= 1024 * 1024;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else
|
||||
g_warning("Could not read key '%s' in buffer '%s'",
|
||||
key, buffer);
|
||||
|
Reference in New Issue
Block a user