From 3881e39238741515913bd14635acb289e4a590d8 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Sun, 6 May 2007 15:54:47 +0000 Subject: Add licenses --- ckcapi-util.h | 53 +++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 16 deletions(-) (limited to 'ckcapi-util.h') diff --git a/ckcapi-util.h b/ckcapi-util.h index 84aa9bd..c160a96 100644 --- a/ckcapi-util.h +++ b/ckcapi-util.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2007 Nate Nielsen + * + * This library 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 2 of the License, or (at your option) any later version. + * + * This library 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 this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ #ifndef __CKCAPI_UTIL_H__ #define __CKCAPI_UTIL_H__ @@ -15,25 +33,23 @@ typedef struct _Array } CkCapiArray; -#define ckcapi_array_append(a,v) \ - ckcapi_array_append_vals(a, &(v), 1) -#define ckcapi_array_index(a,t,i) \ - (((t*) (a)->data) [(i)]) +#define ckcapi_array_append(a,v) ckcapi_array_append_vals(a, &(v), 1) +#define ckcapi_array_index(a,t,i) (((t*) (a)->data) [(i)]) -CkCapiArray* ckcapi_array_new (int zero_terminated, int zero, +CkCapiArray* ckcapi_array_new (int zero_terminated, int zero, size_t element_size); -CkCapiArray* ckcapi_array_sized_new (int zero_terminated, int zero, +CkCapiArray* ckcapi_array_sized_new (int zero_terminated, int zero, size_t element_size, size_t reserved_size); -void* ckcapi_array_free (CkCapiArray* array, int free_segment); +void* ckcapi_array_free (CkCapiArray* array, int free_segment); -int ckcapi_array_append_vals (CkCapiArray* array, const void* data, +int ckcapi_array_append_vals (CkCapiArray* array, const void* data, size_t num); -void ckcapi_array_remove_index (CkCapiArray* array, unsigned int index); +void ckcapi_array_remove_index (CkCapiArray* array, unsigned int index); -void ckcapi_array_remove_range (CkCapiArray* array, unsigned int index, +void ckcapi_array_remove_range (CkCapiArray* array, unsigned int index, size_t count); @@ -46,11 +62,16 @@ typedef struct _CkCapiHash CkCapiHash; typedef void (*CkCapiHashDestroy)(void* val); -CkCapiHash* ckcapi_hash_new(); -void ckcapi_hash_free(CkCapiHash* ht, CkCapiHashDestroy destroy_func); -size_t ckcapi_hash_count(CkCapiHash* ht); -void* ckcapi_hash_get(CkCapiHash* ht, const void* key, size_t klen); -int ckcapi_hash_set(CkCapiHash* ht, const void* key, size_t klen, void* val); -void* ckcapi_hash_rem(CkCapiHash* ht, const void* key, size_t klen); +CkCapiHash* ckcapi_hash_new (void); + +void ckcapi_hash_free (CkCapiHash* ht, CkCapiHashDestroy destroy_func); + +size_t ckcapi_hash_count (CkCapiHash* ht); + +void* ckcapi_hash_get (CkCapiHash* ht, const void* key, size_t klen); + +int ckcapi_hash_set (CkCapiHash* ht, const void* key, size_t klen, void* val); + +void* ckcapi_hash_rem (CkCapiHash* ht, const void* key, size_t klen); #endif /* __CKCAPI_UTIL_H__ */ \ No newline at end of file -- cgit v1.2.3