Server 0.0.1
HTTP/REST server implementation

src/cbuf/set_data.c

Go to the documentation of this file.
00001 
00023 #include <sys/types.h>
00024 #include <string.h>
00025 #include <errno.h>
00026 
00027 #include "cbuf.h"
00028 
00029 char *
00030 cbufSetData(Cbuf this, const void * src, size_t n)
00031 {
00032         char * addr;
00033 
00034         if (n > cbufGetFree(this)) {
00035                 errno = ECBUFOVFL;
00036                 return (char *)-1;
00037         }
00038 
00039         addr = memcpy(cbufGetWrite(this), src, n);
00040         cbufIncWrite(this, n);
00041 
00042         return addr;
00043 }
00044 
00045 // vim: set ts=4 sw=4:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines