Return to buf.c CVS log | Up to [local] / src / usr.bin / rcs |
version 1.24, 2015/02/05 12:59:58 | version 1.25, 2015/06/13 20:15:21 | ||
---|---|---|---|
|
|
||
#include <fcntl.h> | #include <fcntl.h> | ||
#include <stdint.h> | #include <stdint.h> | ||
#include <stdio.h> | #include <stdio.h> | ||
#include <stdlib.h> | |||
#include <string.h> | #include <string.h> | ||
#include <unistd.h> | #include <unistd.h> | ||
|
|
||
void | void | ||
buf_free(BUF *b) | buf_free(BUF *b) | ||
{ | { | ||
if (b->cb_buf != NULL) | free(b->cb_buf); | ||
xfree(b->cb_buf); | free(b); | ||
xfree(b); | |||
} | } | ||
/* | /* | ||
* Free the buffer <b>'s structural information but do not free the contents | * Free the buffer <b>'s structural information but do not free the contents | ||
* of the buffer. Instead, they are returned and should be freed later using | * of the buffer. Instead, they are returned and should be freed later using | ||
* xfree(). | * free(). | ||
*/ | */ | ||
void * | void * | ||
buf_release(BUF *b) | buf_release(BUF *b) | ||
|
|
||
void *tmp; | void *tmp; | ||
tmp = b->cb_buf; | tmp = b->cb_buf; | ||
xfree(b); | free(b); | ||
return (tmp); | return (tmp); | ||
} | } | ||