Browse Source

add quick fit to cbuf

release0.1.5
Georg Hopp 12 years ago
parent
commit
53baa54470
  1. 2
      include/cbuf.h
  2. 5
      src/cbuf/cbuf.c

2
include/cbuf.h

@ -38,11 +38,13 @@
#include "stream.h"
#include "commons.h"
#include "utils/memory.h"
#define ECBUFOVFL 100
CLASS(Cbuf) {
struct memSegment * shm_name_seg;
char * shm_name; // shared memory identifier
char * data;

5
src/cbuf/cbuf.c

@ -53,7 +53,8 @@ cbufCtor(void * _this, va_list * params)
int shm;
char * data;
this->shm_name = malloc(strlen(shm_name) + 7 + 2);
this->shm_name_seg = memMalloc(strlen(shm_name) + 7 + 2);
this->shm_name = this->shm_name_seg->ptr;
sprintf(this->shm_name, "/%06d_%s", getpid(), shm_name);
/**
@ -110,7 +111,7 @@ cbufDtor(void * _this)
{
Cbuf this = _this;
FREE(this->shm_name);
MEM_FREE(this->shm_name_seg);
if (NULL != this->data && MAP_FAILED != this->data) {
munmap(this->data, this->bsize << 1);

Loading…
Cancel
Save