void DynLib_setInitFuncName_(DynLib *self, const char *name) { size_t len = strlen(name); char* ptr = (char*)io_realloc(self->initFuncName, len + 1); PortableStrlcpy(ptr, name, len + 1); self->initFuncName = ptr; }
void SHash_copy_(SHash *self, SHash *other) { SHashRecord *records = self->records; memcpy(self, other, sizeof(SHash)); self->records = (SHashRecord *)io_realloc(records, sizeof(SHashRecord) * self->tableSize * 2); memcpy(self->records, other->records, sizeof(SHashRecord) * self->tableSize * 2); }
void DynLib_setPath_(DynLib *self, const char *path) { size_t len = strlen(path); char *ptr = (char*)io_realloc(self->path, len + 1); PortableStrlcpy(ptr, path, len + 1); self->path = ptr; }
IPAddress *IPAddress_setIPAddress_size_(IPAddress *self, struct sockaddr *address, size_t size) { self->sockaddr = io_realloc(self->sockaddr, size); memcpy(self->sockaddr, address, size); self->size = size; return self; }
void Stack_resize(Stack *self) { int oldSize = (self->memEnd - self->items)*sizeof(void *); int newSize = oldSize*STACK_RESIZE_FACTOR; int i = self->top - self->items; self->items = (void **)io_realloc(self->items, newSize); self->top = self->items + i; self->memEnd = self->items + (newSize/sizeof(void *)); }
void Stack_copy_(Stack *self, const Stack *other) { ptrdiff_t nItems = self->top - self->items; ptrdiff_t size = nItems + 1; ptrdiff_t sizeInBytes = size*sizeof(void *); self->items = (void **)io_realloc(self->items, sizeInBytes); memcpy(self->items, other->items, sizeInBytes); self->memEnd = self->items + size; self->top = self->items + nItems; }
void DynLib_setError_(DynLib *self,const char *error) { if (error) { self->error = strcpy((char *)io_realloc(self->error, strlen(error)+1), error); } else { if (self->error) io_free(self->error); self->error = NULL; } }
void Image_error_(Image *self, const char *error) { if (error && strlen(error)) { /*printf("Image_error_(%s)\n", error);*/ self->error = strcpy((char *)io_realloc(self->error, strlen(error)+1), error); } else { if (self->error) io_free(self->error); self->error = NULL; } }
void IoTag_name_(IoTag *self, const char *name) { self->name = strcpy((char *)io_realloc(self->name, strlen(name)+1), name); }
void IoLexer_string_(IoLexer *self, const char *string) { self->s = strcpy((char *)io_realloc(self->s, strlen(string) + 1), string); self->current = self->s; IoLexer_buildLineIndex(self); }
void Image_fileType_(Image *self, const char *fileType) { self->fileType = strcpy((char *)io_realloc(self->fileType, strlen(fileType)+1), fileType); }
void Image_path_(Image *self, const char *path) { self->path = strcpy((char *)io_realloc(self->path, strlen(path)+1), path); Image_getFileType(self); }
void Stack_compact(Stack *self) { int oldSize = (1 + self->top - self->items)*sizeof(void *); self->items = (void **)io_realloc(self->items, oldSize); }