taskrambler  0.1.9
Web server and task management solution.
set_data.c File Reference
#include <sys/types.h>
#include <string.h>
#include <errno.h>
#include "cbuf.h"
+ Include dependency graph for set_data.c:

Go to the source code of this file.

Functions

char * cbufSetData (Cbuf this, const void *src, size_t n)
 

Detailed Description

Author
Georg Hopp

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file set_data.c.

Function Documentation

char* cbufSetData ( Cbuf  this,
const void *  src,
size_t  n 
)

Definition at line 30 of file set_data.c.

References cbufGetFree(), cbufGetWrite(), cbufIncWrite(), and ECBUFOVFL.

Referenced by httpParserParse().

31 {
32  char * addr;
33 
34  if (n > cbufGetFree(this)) {
35  errno = ECBUFOVFL;
36  return (char *)-1;
37  }
38 
39  addr = memcpy(cbufGetWrite(this), src, n);
40  cbufIncWrite(this, n);
41 
42  return addr;
43 }
size_t cbufGetFree(Cbuf this)
Definition: get_free.c:28
#define ECBUFOVFL
Definition: cbuf.h:43
char * cbufGetWrite(Cbuf this)
Definition: get_write.c:26
void cbufIncWrite(Cbuf this, size_t n)
Definition: inc_write.c:28

+ Here is the call graph for this function:

+ Here is the caller graph for this function: