Esempio n. 1
0
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;
}
Esempio n. 2
0
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);
}
Esempio n. 3
0
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;
}
Esempio n. 4
0
File: IPAddress.c Progetto: ckeen/io
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;
}
Esempio n. 5
0
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 *));
}
Esempio n. 6
0
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;
}
Esempio n. 7
0
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;
	}
}
Esempio n. 8
0
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;
	}
}
Esempio n. 9
0
void IoTag_name_(IoTag *self, const char *name)
{
	self->name = strcpy((char *)io_realloc(self->name, strlen(name)+1), name);
}
Esempio n. 10
0
File: IoLexer.c Progetto: Akiyah/io
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);
}
Esempio n. 11
0
void Image_fileType_(Image *self, const char *fileType)
{
	self->fileType = strcpy((char *)io_realloc(self->fileType, strlen(fileType)+1), fileType);
}
Esempio n. 12
0
void Image_path_(Image *self, const char *path)
{
	self->path = strcpy((char *)io_realloc(self->path, strlen(path)+1), path);
	Image_getFileType(self);
}
Esempio n. 13
0
void Stack_compact(Stack *self)
{
	int oldSize = (1 + self->top - self->items)*sizeof(void *);
	self->items = (void **)io_realloc(self->items, oldSize);
}