2 #include <linux/kernel.h>
6 for (; ; str++, prefix++)
9 else if (*str != *prefix)
10 return (
unsigned char)*prefix - (
unsigned char)*str;
47 if (sb->
len + extra + 1 <= sb->
len)
48 die(
"you want to use way too much memory");
54 static void strbuf_splice(
struct strbuf *
sb,
size_t pos,
size_t len,
58 die(
"you want to use way too much memory");
60 die(
"`pos' is too far after the end of the buffer");
61 if (pos + len > sb->
len)
62 die(
"`pos + len' is too far after the end of the buffer");
70 strbuf_setlen(sb, sb->
len + dlen - len);
75 strbuf_splice(sb, pos, len,
NULL, 0);
82 strbuf_setlen(sb, sb->
len + len);
90 if (!strbuf_avail(sb))
96 die(
"your vsnprintf is broken");
97 if (len > strbuf_avail(sb)) {
102 if (len > strbuf_avail(sb)) {
103 die(
"this should not happen, your vsnprintf is broken");
106 strbuf_setlen(sb, sb->
len + len);
111 size_t oldlen = sb->
len;
112 size_t oldalloc = sb->
alloc;
123 strbuf_setlen(sb, oldlen);
133 return sb->
len - oldlen;