inital commit. currently all winapi

This commit is contained in:
2016-04-03 17:04:20 +02:00
commit 3b681758f4
76 changed files with 13747 additions and 0 deletions

54
list.c Normal file
View File

@@ -0,0 +1,54 @@
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "list.h"
struct ListHead* list_create()
{
return calloc(1, sizeof(struct ListHead));
}
int list_add(struct ListHead* head, void* data, size_t size)
{
assert(head);
struct ListElem* p = malloc(sizeof(struct ListElem) + size);
if(!p)
return -1;
p->next = NULL;
p->dataSize = size;
memcpy((char*)p + sizeof(struct ListElem), data, size);
p->dataStart = (char*)p + sizeof(struct ListElem);
// First elem to ever be added?
if(!head->end)
{
head->end = head->start = p;
}
else
{
head->end->next = p;
head->end = p;
}
return 0;
}
// todo:
int list_free(struct ListHead* head)
{
struct ListElem* p = head->start;
while(p)
{
struct ListElem* pOld = p;
p = p->next;
free(pOld);
}
free(head);
return 0;
}