X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcutil%2Fsilclist.h;h=81ea3638bd8a468c9a4501c9eb55c1e353c9932c;hb=52e57c880aba9c5e89f59d962eb9af75670b76e0;hp=50213491f0b361239d015a5cd08606752499b777;hpb=0f0340b9fbce9704cc7171f8f0104ce9103d2de6;p=silc.git diff --git a/lib/silcutil/silclist.h b/lib/silcutil/silclist.h index 50213491..81ea3638 100644 --- a/lib/silcutil/silclist.h +++ b/lib/silcutil/silclist.h @@ -4,7 +4,7 @@ Author: Pekka Riikonen - Copyright (C) 2002 - 2005 Pekka Riikonen + Copyright (C) 2002 - 2007 Pekka Riikonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,7 +22,10 @@ * DESCRIPTION * * Implementation of the SilcList interface. This interface provides - * simple linked list. + * simple linked list. This interface does not allocate any memory. + * + * SILC List is not thread-safe. If the same list context must be used + * in multithreaded environment concurrency control must be employed. * ***/ @@ -41,12 +44,12 @@ * function silc_list_init. * ***/ -typedef struct { +typedef struct SilcListStruct { void *head; /* Start of the list */ void *tail; /* End of the list */ void *current; /* Current pointer in list */ - unsigned int next_offset : 16; /* Offset to 'next' pointer */ - unsigned int prev_offset : 16; /* Offset to 'prev' pointer */ + SilcUInt16 next_offset; /* Offset to 'next' pointer */ + SilcUInt16 prev_offset; /* Offset to 'prev' pointer */ unsigned int prev_set : 1; /* Set if 'prev' exists */ unsigned int end_set : 1; /* Set if silc_list_end was called */ unsigned int count : 30; /* Number of entries in the list */ @@ -101,6 +104,7 @@ do { \ (list).next_offset = silc_offsetof(type, nextfield); \ (list).prev_set = 0; \ (list).prev_offset = 0; \ + (list).end_set = 0; \ (list).head = (list).tail = (list).current = NULL; \ } while(0) @@ -140,6 +144,7 @@ do { \ (list).next_offset = silc_offsetof(type, nextfield); \ (list).prev_offset = silc_offsetof(type, prevfield); \ (list).prev_set = 1; \ + (list).end_set = 0; \ (list).head = (list).tail = (list).current = NULL; \ } while(0)