Deleted Added
full compact
subr_sbuf.c (131868) subr_sbuf.c (131869)
1/*-
2 * Copyright (c) 2000 Poul-Henning Kamp and Dag-Erling Co�dan Sm�rgrav
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2000 Poul-Henning Kamp and Dag-Erling Co�dan Sm�rgrav
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/kern/subr_sbuf.c 131868 2004-07-09 11:35:30Z des $");
30__FBSDID("$FreeBSD: head/sys/kern/subr_sbuf.c 131869 2004-07-09 11:37:44Z des $");
31
32#include <sys/param.h>
33
34#ifdef _KERNEL
35#include <sys/ctype.h>
36#include <sys/kernel.h>
37#include <sys/malloc.h>
38#include <sys/systm.h>

--- 217 unchanged lines hidden (view full) ---

256 s->s_len = pos;
257 return (0);
258}
259
260/*
261 * Append a byte string to an sbuf.
262 */
263int
31
32#include <sys/param.h>
33
34#ifdef _KERNEL
35#include <sys/ctype.h>
36#include <sys/kernel.h>
37#include <sys/malloc.h>
38#include <sys/systm.h>

--- 217 unchanged lines hidden (view full) ---

256 s->s_len = pos;
257 return (0);
258}
259
260/*
261 * Append a byte string to an sbuf.
262 */
263int
264sbuf_bcat(struct sbuf *s, const void *data, size_t len)
264sbuf_bcat(struct sbuf *s, const void *buf, size_t len)
265{
265{
266 const char *str = data;
266 const char *str = buf;
267
268 assert_sbuf_integrity(s);
269 assert_sbuf_state(s, 0);
270
271 if (SBUF_HASOVERFLOWED(s))
272 return (-1);
273
274 for (; len; len--) {

--- 34 unchanged lines hidden (view full) ---

309 return (0);
310}
311#endif
312
313/*
314 * Copy a byte string into an sbuf.
315 */
316int
267
268 assert_sbuf_integrity(s);
269 assert_sbuf_state(s, 0);
270
271 if (SBUF_HASOVERFLOWED(s))
272 return (-1);
273
274 for (; len; len--) {

--- 34 unchanged lines hidden (view full) ---

309 return (0);
310}
311#endif
312
313/*
314 * Copy a byte string into an sbuf.
315 */
316int
317sbuf_bcpy(struct sbuf *s, const void *data, size_t len)
317sbuf_bcpy(struct sbuf *s, const void *buf, size_t len)
318{
319 assert_sbuf_integrity(s);
320 assert_sbuf_state(s, 0);
321
322 sbuf_clear(s);
318{
319 assert_sbuf_integrity(s);
320 assert_sbuf_state(s, 0);
321
322 sbuf_clear(s);
323 return (sbuf_bcat(s, data, len));
323 return (sbuf_bcat(s, buf, len));
324}
325
326/*
327 * Append a string to an sbuf.
328 */
329int
330sbuf_cat(struct sbuf *s, const char *str)
331{

--- 245 unchanged lines hidden ---
324}
325
326/*
327 * Append a string to an sbuf.
328 */
329int
330sbuf_cat(struct sbuf *s, const char *str)
331{

--- 245 unchanged lines hidden ---