From 2a49e4e1d64ef2df0bb2a8a3822f7fa1048e687f Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Tue, 17 Sep 2013 12:45:00 +0000 Subject: a major refactoring in the C runtime. GuList is now removed and replaced with GuSeq. The GuSeq/GuBuf API is simplified --- src/runtime/c/gu/list.c | 59 ------------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 src/runtime/c/gu/list.c (limited to 'src/runtime/c/gu/list.c') diff --git a/src/runtime/c/gu/list.c b/src/runtime/c/gu/list.c deleted file mode 100644 index d98a42e41..000000000 --- a/src/runtime/c/gu/list.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2010 University of Helsinki. - * - * This file is part of libgu. - * - * Libgu is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. - * - * Libgu is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with libgu. If not, see . - */ - -#include -#include -#include - -static const int gu_list_empty = 0; - -void* gu_list_alloc(GuPool* pool, size_t base_size, size_t elem_size, - int n_elems, size_t alignment) -{ - gu_assert(n_elems >= 0); - if (n_elems == 0) { - return (void*) &gu_list_empty; - } - // XXX: use gu_flex_size, use offset of elems - void* p = gu_malloc_aligned(pool, base_size + elem_size * n_elems, - alignment); - *(int*) p = n_elems; - return p; -} - - -GU_DEFINE_KIND(GuList, abstract); - -// GU_DEFINE_TYPE(GuStrs, GuList, gu_type(GuStr)); -// GU_DEFINE_TYPE(GuStrsP, pointer, gu_type(GuStrs)); - -void* -gu_list_type_alloc(GuListType* ltype, int n_elems, GuPool* pool) -{ - return gu_list_alloc(pool, ltype->size, - gu_type_size(ltype->elem_type), - n_elems, ltype->align); -} - -void* -gu_list_type_index(GuListType* ltype, void* list, int i) -{ - uint8_t* p = list; - return &p[ltype->elems_offset + i * gu_type_size(ltype->elem_type)]; -} -- cgit v1.2.3