PERFORCE change 119587 for review
Fredrik Lindberg
fli at FreeBSD.org
Wed May 9 18:53:55 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=119587
Change 119587 by fli at fli_genesis on 2007/05/09 18:52:54
Add a function to expand the size of an existing buffer segment
Affected files ...
.. //depot/projects/soc2007/fli-mdns_sd/mdnsd/stack_buf.c#3 edit
Differences ...
==== //depot/projects/soc2007/fli-mdns_sd/mdnsd/stack_buf.c#3 (text+ko) ====
@@ -190,6 +190,26 @@
MDNS_BP_UNLOCK(bp);
}
+int
+mdns_buf_expand(struct mdns_buf *buf, size_t len)
+{
+ char *p;
+
+ if (len == 0)
+ len = buf->b_sz * 2;
+ else if (len < buf->b_len)
+ return (-1);
+
+ p = realloc(buf->b_buf, len);
+ if (p == NULL)
+ return (-1);
+
+ buf->b_sz = len;
+ buf->b_buf = p;
+ buf->b_flags |= MDNS_BUF_TEMP;
+ return (0);
+}
+
/*
* Merge a chain of buffer segments into one continuous buffer
*/
More information about the p4-projects
mailing list