/// Constructs an instance from the given errno value
 ss_explicit_k
 errno_exception(int e)
     : parent_class_type(make_message_(e))
     , ErrnoValue(e)
 {
     free_(context_);
 }
Esempio n. 2
0
void free(void* ptr)
{
	if (!ptr) return;
	if (ptr==ZERO_SIZE_POINTER) return;
	if (ignore==0)
	{
		ignore++;
		cb.free(ptr);
		ignore--;
	}
	free_(ptr);
}
Esempio n. 3
0
/**
 * This function frees the given string_hash_ptr, using 'free_' (if not NULL)
 * to free the elements of the 'value' array.
 */
void free_string_hash_ptr(struct string_hash_ptr* s,void (*free_)(void*)) {
if (s==NULL) return;
/* If necessary, we free the 'value' array */
if (free_!=NULL) {
   for (int i=0;i<s->hash->size;i++) {
      free_(s->value[i]);
   }
}
free(s->value);
free_string_hash(s->hash);
free(s);
}
Esempio n. 4
0
 void schema::load_from_file(const std::string& file_name)
 {
     free_();
     xmlSchemaParserCtxt* ctxt = xmlSchemaNewParserCtxt(file_name.c_str());
     if (ctxt != 0)
     {
         raw_ = xmlSchemaParse(ctxt);
         xmlSchemaFreeParserCtxt(ctxt);
     }
     if (raw_ == 0)
     {
         std::string what = "failed to load schema from file " + file_name;
         throw dom_error(what);
     }
 }
Esempio n. 5
0
 void schema::load_from_string(const char* str)
 {
     free_();
     int size = static_cast<int>(std::strlen(str));
     xmlSchemaParserCtxt* ctxt = xmlSchemaNewMemParserCtxt(str, size);
     if (ctxt != 0)
     {
         raw_ = xmlSchemaParse(ctxt);
         xmlSchemaFreeParserCtxt(ctxt);
     }
     if (raw_ == 0)
     {
         throw dom_error("failed to load schema from string");
     }
 }
Esempio n. 6
0
static struct video * cvideo_create_ddraw(uintptr_t windowhandle, unsigned int screen_width, unsigned int screen_height,
                                   videoformat depth, double fps)
{
	struct video_ddraw * this=malloc(sizeof(struct video_ddraw));
	this->i.reinit=reinit;
	this->i.draw=draw;
	this->i.set_sync=set_sync;
	this->i.has_sync=has_sync;
	this->i.free=free_;
	
	if (true) goto cancel;
	
	return (struct video*)this;
	
cancel:
	free_((struct video*)this);
	return NULL;
}
Esempio n. 7
0
inline void Allocator::free_(MemRef mem) noexcept
{
    free_(mem.get_ref(), mem.get_addr());
}
Esempio n. 8
0
void TiledLevelArray::reset() {
	if (_w!=0 && _h!=0) {
		free_();
		init_();
	}
}
Esempio n. 9
0
TiledLevelArray::~TiledLevelArray() {
	free_();
}
Esempio n. 10
0
 schema::~schema()
 {
     free_();
 }
Esempio n. 11
0
File: nand.c Progetto: Styden/ibex
int
read_llb(h2fmi_read_boot_page_t read_page, int offset, int size, unsigned char *buf)
{
    int rv = 0;
    int page = div(offset, LLB_PAGE_SIZE); /*offset / LLB_PAGE_SIZE*/
    int start = offset - page * LLB_PAGE_SIZE; /*offset % LLB_PAGE_SIZE*/
#if 0
    unsigned char *tmp = malloc_(4096);
    if (!tmp) {
        return -1;
    }

    for (page += 2; size > 0; page++) {
        int chunk = size;
        if (chunk > LLB_PAGE_SIZE - start) {
            chunk = LLB_PAGE_SIZE - start;
        }

        rv = read_page(0, page, tmp);
        if (rv) {
            break;
        }

        memcpy(buf, tmp + start, chunk);

        start = 0;
        buf += chunk;
        size -= chunk;
    }
#else  /* XXX more efficient, but should be used ONLY if read_page reads exactly LLB_PAGE_SIZE bytes */
    unsigned char *tmp = NULL;

    page += 2;
    if (start) {
        int chunk = LLB_PAGE_SIZE - start;
        if (!(tmp = malloc_(LLB_PAGE_SIZE))) return -1;
        rv = read_page(0, page, tmp);
        if (rv) {
            goto err;
        }
        memcpy(buf, tmp + start, chunk);
        buf += chunk;
        size -= chunk;
        page++;
    }

    for (; size >= LLB_PAGE_SIZE; page++) {
        rv = read_page(0, page, buf);
        if (rv) {
            goto err;
        }
        buf += LLB_PAGE_SIZE;
        size -= LLB_PAGE_SIZE;
    }

    if (size) {
        if (!tmp && !(tmp = malloc_(LLB_PAGE_SIZE))) return -1;
        rv = read_page(0, page, tmp);
        if (rv == 0) {
            memcpy(buf, tmp, size);
        }
    }

  err:
#endif

    free_(tmp);
    return rv;
}
Esempio n. 12
0
/* ----------------------------------------------------------------------- */
void kfree (void *addr)
{
  // size_t size = ((int*)addr)[-4];
  // kSYS.objMemory_ -= size;
  free_(addr);
}