return buf;
}
-/* strdup with a limit */
-char *pstrdup(const char *str, size_t buf_size)
-{
- size_t len;
- char *buf;
-
- len = MIN(buf_size, strlen(str));
- buf = qemu_malloc(len);
- pstrcpy(buf, len, str);
- return buf;
-}
-
int strstart(const char *str, const char *val, const char **ptr)
{
const char *p, *q;
p = str;
q = val;
while (*q != '\0') {
- if (toupper(*p) != toupper(*q))
+ if (qemu_toupper(*p) != qemu_toupper(*q))
return 0;
p++;
q++;
t += 3600 * tm->tm_hour + 60 * tm->tm_min + tm->tm_sec;
return t;
}
+
+int fls(int i)
+{
+ int bit;
+
+ for (bit=31; bit >= 0; bit--)
+ if (i & (1 << bit))
+ return bit+1;
+
+ return 0;
+}