gwenhywfar  4.99.8beta
idlist64.c
Go to the documentation of this file.
1 /***************************************************************************
2  begin : Mon Mar 01 2004
3  copyright : (C) 2018 by Martin Preuss
4  email : martin@libchipcard.de
5 
6  ***************************************************************************
7  * *
8  * This library is free software; you can redistribute it and/or *
9  * modify it under the terms of the GNU Lesser General Public *
10  * License as published by the Free Software Foundation; either *
11  * version 2.1 of the License, or (at your option) any later version. *
12  * *
13  * This library is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16  * Lesser General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU Lesser General Public *
19  * License along with this library; if not, write to the Free Software *
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
21  * MA 02111-1307 USA *
22  * *
23  ***************************************************************************/
24 
25 
26 
27 #ifdef HAVE_CONFIG_H
28 # include <config.h>
29 #endif
30 
31 #define DISABLE_DEBUGLOG
32 
33 #include "idlist64_p.h"
34 #include <gwenhywfar/debug.h>
35 
36 
37 #include <stdlib.h>
38 #include <assert.h>
39 #include <string.h>
40 
41 /* Uncomment this to use the old compact mode of entry storage
42  * compact means that empty entries within tables are filled from begin on when
43  * adding new entries (this was the old mode of id allocation).
44  * The new mode is to add entries to the last table. If the last table is full
45  * a new table is created and the new id added to that table.
46  */
47 /*#define GWEN_IDLIST64_COMPACT */
48 
49 
50 GWEN_IDTABLE64 *GWEN_IdTable64_new(void) {
51  GWEN_IDTABLE64 *idt;
52 
53  GWEN_NEW_OBJECT(GWEN_IDTABLE64, idt);
54  idt->refCount=1;
55 
56  idt->freeEntries=GWEN_IDTABLE64_MAXENTRIES;
57  return idt;
58 }
59 
60 
61 
62 void GWEN_IdTable64_free(GWEN_IDTABLE64 *idt) {
63  if (idt) {
64  assert(idt->refCount);
65  if (--(idt->refCount)==0) {
66  GWEN_FREE_OBJECT(idt);
67  }
68  }
69 }
70 
71 
72 
73 #if 0
74 void GWEN_IdTable64_Attach(GWEN_IDTABLE64 *idt) {
75  assert(idt);
76  assert(idt->refCount);
77  idt->refCount++;
78 }
79 #endif
80 
81 
82 
83 static inline int GWEN_IdTable64_AddId(GWEN_IDTABLE64 *idt, uint64_t id) {
84  unsigned int i;
85 
86  for (i=0; i<GWEN_IDTABLE64_MAXENTRIES; i++) {
87  if (idt->entries[i]==0) {
88  idt->entries[i]=id;
89  idt->freeEntries--;
90  return 0;
91  }
92  } /* for */
93  return -1;
94 }
95 
96 
97 
98 static inline int GWEN_IdTable64_AppendId(GWEN_IDTABLE64 *idt, uint64_t id) {
99  if (idt->freeEntries) {
100  unsigned int i;
101 
102  i=GWEN_IDTABLE64_MAXENTRIES-idt->freeEntries;
103  idt->entries[i]=id;
104  idt->freeEntries--;
105  return 0;
106  }
107  else
108  return -1;
109 }
110 
111 
112 
113 static inline int GWEN_IdTable64_HasId(const GWEN_IDTABLE64 *idt, uint64_t id) {
114  unsigned int i;
115 
116  for (i=0; i<GWEN_IDTABLE64_MAXENTRIES; i++) {
117  if (idt->entries[i]==id) {
118  return 1;
119  }
120  } /* for */
121  return 0;
122 }
123 
124 
125 
126 static inline int GWEN_IdTable64_DelId(GWEN_IDTABLE64 *idt, uint64_t id) {
127  unsigned int i;
128 
129  for (i=0; i<GWEN_IDTABLE64_MAXENTRIES; i++) {
130  if (idt->entries[i]==id) {
131  idt->entries[i]=0;
132  idt->freeEntries++;
133  return 0;
134  }
135  } /* for */
136  return -1;
137 }
138 
139 
140 
141 static inline int GWEN_IdTable64_IsEmpty(const GWEN_IDTABLE64 *idt) {
142  return GWEN_IDTABLE64_MAXENTRIES==idt->freeEntries;
143 }
144 
145 
146 
147 static inline int GWEN_IdTable64_IsFull(const GWEN_IDTABLE64 *idt) {
148  return idt->freeEntries==0;
149 }
150 
151 
152 #if 0
153 static inline unsigned int GWEN_IdTable64_GetCount(const GWEN_IDTABLE64 *idt) {
154  return GWEN_IDTABLE64_MAXENTRIES-idt->freeEntries;
155 }
156 
157 
158 
159 static inline uint64_t GWEN_IdTable64_GetFirstId(GWEN_IDTABLE64 *idt) {
160  unsigned int i;
161 
162  assert(idt);
163  idt->current=0;
164  for (i=0; i<GWEN_IDTABLE64_MAXENTRIES; i++) {
165  if (idt->entries[i]!=0) {
166  idt->current=i;
167  return idt->entries[i];
168  }
169  } /* for */
170  return 0;
171 }
172 
173 
174 
175 static inline uint64_t GWEN_IdTable64_GetNextId(GWEN_IDTABLE64 *idt) {
176  unsigned int i;
177 
178  for (i=idt->current+1; i<GWEN_IDTABLE64_MAXENTRIES; i++) {
179  if (idt->entries[i]!=0) {
180  idt->current=i;
181  return idt->entries[i];
182  }
183  } /* for */
184  idt->current=GWEN_IDTABLE64_MAXENTRIES;
185  return 0;
186 }
187 
188 
189 
190 static inline uint64_t GWEN_IdTable64_GetFirstId2(const GWEN_IDTABLE64 *idt,
191  uint64_t *tabIdx) {
192  unsigned int i;
193 
194  for (i=0; i<GWEN_IDTABLE64_MAXENTRIES; i++) {
195  if (idt->entries[i]!=0) {
196  *tabIdx=i;
197  return idt->entries[i];
198  }
199  } /* for */
200  return 0;
201 }
202 
203 
204 
205 static inline uint64_t GWEN_IdTable64_GetNextId2(const GWEN_IDTABLE64 *idt,
206  uint64_t *tabIdx) {
207  unsigned int i;
208 
209  for (i=(*tabIdx)+1; i<GWEN_IDTABLE64_MAXENTRIES; i++) {
210  if (idt->entries[i]!=0) {
211  *tabIdx=i;
212  return idt->entries[i];
213  }
214  } /* for */
215  return 0;
216 }
217 #endif
218 
219 
220 
221 
222 
224  GWEN_IDLIST64 *idl;
225 
227  idl->refCount=1;
228  return idl;
229 }
230 
231 
232 
234  assert(idl);
235  assert(idl->refCount);
236  idl->refCount++;
237 }
238 
239 
240 
242  if (idl) {
243  assert(idl->refCount);
244  if (idl->refCount==1) {
245  GWEN_IdList64_Clear(idl);
246  idl->refCount=0;
247  GWEN_FREE_OBJECT(idl);
248  }
249  else
250  idl->refCount--;
251  }
252 }
253 
254 
255 
256 void GWEN_IdList64_AddTable(GWEN_IDLIST64 *idl, GWEN_IDTABLE64 *idt) {
257  GWEN_IDTABLE64 **tablePtr;
258  int idx;
259 
260  assert(idl);
261 
262  tablePtr=idl->pIdTablePointers;
263  for (idx=0, tablePtr=idl->pIdTablePointers; idx<idl->idTableCount; idx++, tablePtr++) {
264  if (*tablePtr==NULL)
265  break;
266  } /* while */
267 
268  if (idx>=idl->idTableCount) {
269  uint32_t newCount;
270  GWEN_IDTABLE64 **newPtr;
271 
272  /* resize */
273  newCount=idl->idTableCount+GWEN_IDLIST64_STEP;
274  newPtr=(GWEN_IDTABLE64 **)realloc(idl->pIdTablePointers, sizeof(GWEN_IDTABLE64*)*newCount);
275  assert(newPtr);
276  /* init new pointers */
277  memset((void*)(newPtr+idl->idTableCount),
278  0,
279  sizeof(GWEN_IDTABLE64*)*(newCount-idl->idTableCount));
280  idl->pIdTablePointers=newPtr;
281  idl->pIdTablePointers[idl->idTableCount]=idt;
282  idl->lastTableIdx=idl->idTableCount; /* this is the idx of the new table, and it is the last one */
283  idl->idTableCount=newCount;
284  }
285  else {
286  idl->pIdTablePointers[idx]=idt;
287  idl->lastTableIdx=idx;
288  }
289 }
290 
291 
292 
293 int GWEN_IdList64_AddId(GWEN_IDLIST64 *idl, uint64_t id) {
294 #ifdef GWEN_IDLIST64_COMPACT
295  GWEN_IDTABLE64 *idt=NULL;
296  GWEN_IDTABLE64 **tablePtr;
297  int idx;
298 
299  assert(idl);
300 
301  if (idl->pIdTablePointers==NULL) {
302  /* create an initial pointer table which can take up to GWEN_IDLIST64_STEP pointers */
303  idl->pIdTablePointers=(GWEN_IDTABLE64 **) malloc(sizeof(GWEN_IDTABLE64*)*GWEN_IDLIST64_STEP);
304  assert(idl->pIdTablePointers);
305  memset(idl->pIdTablePointers, 0, sizeof(GWEN_IDTABLE64*)*GWEN_IDLIST64_STEP);
306  idl->idTableCount=GWEN_IDLIST64_STEP;
307  }
308 
309  for (idx=0, tablePtr=idl->pIdTablePointers; idx<idl->idTableCount; idx++, tablePtr++) {
310  idt=*tablePtr;
311  if (idt && !GWEN_IdTable64_IsFull(idt))
312  break;
313  } /* while */
314 
315  if (idx>=idl->idTableCount) {
316  idt=GWEN_IdTable64_new();
317  GWEN_IdList64_AddTable(idl, idt);
318  }
319  GWEN_IdTable64_AddId(idt, id);
320  idl->entryCount++;
321  return 0;
322 #else
323  GWEN_IDTABLE64 *idt=NULL;
324  int idx;
325 
326  assert(idl);
327 
328  if (idl->pIdTablePointers==NULL) {
329  /* create an initial pointer table which can take up to GWEN_IDLIST64_STEP pointers */
330  idl->pIdTablePointers=(GWEN_IDTABLE64 **) malloc(sizeof(GWEN_IDTABLE64*)*GWEN_IDLIST64_STEP);
331  assert(idl->pIdTablePointers);
332  memset(idl->pIdTablePointers, 0, sizeof(GWEN_IDTABLE64*)*GWEN_IDLIST64_STEP);
333  idl->idTableCount=GWEN_IDLIST64_STEP;
334  }
335  idx=idl->lastTableIdx;
336  idt=idl->pIdTablePointers[idx];
337  if (idt==NULL || GWEN_IdTable64_IsFull(idt)) {
338  idt=GWEN_IdTable64_new();
339  GWEN_IdList64_AddTable(idl, idt);
340  }
341  GWEN_IdTable64_AddId(idt, id);
342  idl->entryCount++;
343  return 0;
344 #endif
345 }
346 
347 
348 
349 int GWEN_IdList64_DelId(GWEN_IDLIST64 *idl, uint64_t id) {
350  if (idl->pIdTablePointers) {
351  GWEN_IDTABLE64 *idt=NULL;
352  GWEN_IDTABLE64 **tablePtr;
353  int idx;
354 
355  for (idx=0, tablePtr=idl->pIdTablePointers; idx<idl->idTableCount; idx++, tablePtr++) {
356  idt=*tablePtr;
357  if (idt && !GWEN_IdTable64_DelId(idt, id)) {
358  /* found a table which had this id */
359  GWEN_IdList64_Clean(idl);
360  idl->entryCount--;
361  return 0;
362  }
363  }
364  }
365 
366  return -1;
367 }
368 
369 
370 
371 int GWEN_IdList64_HasId(const GWEN_IDLIST64 *idl, uint64_t id) {
372  if (idl->pIdTablePointers) {
373  GWEN_IDTABLE64 *idt=NULL;
374  GWEN_IDTABLE64 **tablePtr;
375  int idx;
376 
377  for (idx=0, tablePtr=idl->pIdTablePointers; idx<idl->idTableCount; idx++, tablePtr++) {
378  idt=*tablePtr;
379  if (idt && GWEN_IdTable64_HasId(idt, id))
380  return 1;
381  }
382  }
383 
384  return 0;
385 }
386 
387 
388 
390  GWEN_IDTABLE64 *idt=NULL;
391  GWEN_IDTABLE64 **tablePtr;
392  int idx;
393 
394  for (idx=0, tablePtr=idl->pIdTablePointers; idx<idl->idTableCount; idx++, tablePtr++) {
395  idt=*tablePtr;
396  if (idt && GWEN_IdTable64_IsEmpty(idt)) {
397  GWEN_IdTable64_free(idt);
398  *tablePtr=NULL;
399  }
400  }
401 }
402 
403 
404 
406  if (idl->pIdTablePointers) {
407  GWEN_IDTABLE64 *idt=NULL;
408  GWEN_IDTABLE64 **tablePtr;
409  int idx;
410 
411  for (idx=0, tablePtr=idl->pIdTablePointers; idx<idl->idTableCount; idx++, tablePtr++) {
412  idt=*tablePtr;
413  if (idt) {
414  GWEN_IdTable64_free(idt);
415  *tablePtr=NULL;
416  }
417  }
418  free(idl->pIdTablePointers);
419  idl->pIdTablePointers=NULL;
420  }
421  idl->entryCount=0;
422  idl->nextIdx=0;
423 }
424 
425 
426 
427 static int __compAscending(const void *pa, const void *pb) {
428  uint64_t a=*((const uint64_t*)pa);
429  uint64_t b=*((const uint64_t*)pb);
430 
431  if (a<b)
432  return -1;
433  else if (a>b)
434  return 1;
435  else
436  return 0;
437 }
438 
439 
440 
441 static int __compDescending(const void *pa, const void *pb) {
442  uint64_t a=*((const uint64_t*)pa);
443  uint64_t b=*((const uint64_t*)pb);
444 
445  if (a<b)
446  return 1;
447  else if (a>b)
448  return -1;
449  else
450  return 0;
451 }
452 
453 
454 
455 static int GWEN_IdList64__Sort(GWEN_IDLIST64 *idl, int ascending) {
456  assert(idl);
457  assert(idl->refCount);
458  if (idl->pIdTablePointers && idl->entryCount) {
460  unsigned int cnt;
461  uint64_t *ptr;
462  unsigned int i;
463 
464  assert(idl);
465 
466  /* count ids */
467  cnt=idl->entryCount;
468 
469  /* move ids to a temporary list */
470  ptr=(uint64_t*)malloc(sizeof(uint64_t)*cnt);
471  assert(ptr);
472 
474  for (i=0; i<cnt; i++) {
475  uint64_t id;
476 
477  if (i==0)
479  else
481  assert(id);
482  ptr[i]=id;
483  } /* for */
485 
486  /* remove all tables (we will add sorted tables later) */
487  GWEN_IdList64_Clear(idl);
488 
489  if (ascending)
490  qsort(ptr, cnt, sizeof(uint64_t), __compAscending);
491  else
492  qsort(ptr, cnt, sizeof(uint64_t), __compDescending);
493 
494  /* move back sorted list of ids from temporary list */
495  for (i=0; i<cnt; i++) {
496  GWEN_IdList64_AddId(idl, ptr[i]);
497  }
498  free(ptr);
499  }
500  return 0;
501 }
502 
503 
504 
506  return GWEN_IdList64__Sort(idl, 1);
507 }
508 
509 
510 
512  return GWEN_IdList64__Sort(idl, 0);
513 }
514 
515 
516 
518  GWEN_IDLIST64 *nidl;
519  int idx;
520 
521  nidl=GWEN_IdList64_new();
522 
523  nidl->idTableCount=idl->idTableCount;
524  nidl->entryCount=idl->entryCount;
525  if (idl->pIdTablePointers) {
526  for (idx=0; idx<idl->idTableCount; idx++) {
527  GWEN_IDTABLE64 *idt;
528 
529  idt=idl->pIdTablePointers[idx];
530  if (idt && !GWEN_IdTable64_IsEmpty(idt)) {
531  GWEN_IDTABLE64 *nidt;
532 
533  nidt=GWEN_IdTable64_new();
534  memmove(nidt->entries, idt->entries, GWEN_IDTABLE64_MAXENTRIES*sizeof(uint64_t));
535  nidt->freeEntries=idt->freeEntries;
536  GWEN_IdList64_AddTable(nidl, nidt);
537  }
538  }
539  }
540 
541  return nidl;
542 }
543 
544 
545 
547  assert(idl);
548  assert(idl->refCount);
549 
550  return idl->entryCount;
551 }
552 
553 
554 
555 uint64_t GWEN_IdList64__GetFirstId(const GWEN_IDLIST64 *idl, uint64_t *pos) {
556  GWEN_IDTABLE64 *idt=NULL;
557  GWEN_IDTABLE64 **tablePtr;
558  int idx;
559  int idIndex=0;
560 
561  *pos=0;
562  for (idx=0, tablePtr=idl->pIdTablePointers; idx<idl->idTableCount; idx++, tablePtr++) {
563  idt=*tablePtr;
564  if (idt && !GWEN_IdTable64_IsEmpty(idt)) {
565  int i;
566  uint64_t id;
567 
568  for (i=0; i<GWEN_IDTABLE64_MAXENTRIES; i++) {
569  if (idt->entries[i]!=0) {
570  id=idt->entries[i];
571  *pos=idIndex+i+1;
572  return id;
573  }
574  }
575  }
576  idIndex+=GWEN_IDTABLE64_MAXENTRIES;
577  }
578 
579  return 0;
580 }
581 
582 
583 
584 uint64_t GWEN_IdList64__GetNextId(const GWEN_IDLIST64 *idl, uint64_t *pos) {
585  if (*pos) {
586  GWEN_IDTABLE64 *idt;
587  uint64_t tableNum=*pos / GWEN_IDTABLE64_MAXENTRIES;
588  uint64_t tableIdx=*pos % GWEN_IDTABLE64_MAXENTRIES;
589  GWEN_IDTABLE64 **tablePtr;
590  int idIndex=0;
591  int idx;
592 
593  if (tableNum>idl->idTableCount) {
594  DBG_ERROR(GWEN_LOGDOMAIN, "Table number out of range");
595  *pos=0;
596  return 0;
597  }
598 
599  idIndex=(tableNum*GWEN_IDTABLE64_MAXENTRIES);
600  for (idx=tableNum, tablePtr=idl->pIdTablePointers+tableNum; idx<idl->idTableCount; idx++, tablePtr++) {
601  idt=*tablePtr;
602  if (idt && !GWEN_IdTable64_IsEmpty(idt)) {
603  int i;
604  uint64_t id;
605 
606  if (idx==tableNum) {
607  for (i=tableIdx; i<GWEN_IDTABLE64_MAXENTRIES; i++) {
608  if (idt->entries[i]!=0) {
609  id=idt->entries[i];
610  *pos=idIndex+i+1;
611  return id;
612  }
613  }
614  }
615  else {
616  for (i=0; i<GWEN_IDTABLE64_MAXENTRIES; i++) {
617  if (idt->entries[i]!=0) {
618  id=idt->entries[i];
619  *pos=idIndex+i+1;
620  return id;
621  }
622  }
623  }
624  }
625  idIndex+=GWEN_IDTABLE64_MAXENTRIES;
626  }
627  *pos=0;
628  }
629 
630  return 0;
631 }
632 
633 
634 
635 #ifndef NO_DEPRECATED_SYMBOLS
637  return GWEN_IdList64__GetFirstId(idl, &(idl->nextIdx));
638 }
639 
640 
641 
643  return GWEN_IdList64__GetNextId(idl, &(idl->nextIdx));
644 }
645 
646 
647 
648 uint64_t GWEN_IdList64_GetFirstId2(const GWEN_IDLIST64 *idl, uint64_t *pos) {
649  return GWEN_IdList64__GetFirstId(idl, pos);
650 }
651 
652 
653 
654 uint64_t GWEN_IdList64_GetNextId2(const GWEN_IDLIST64 *idl, uint64_t *pos) {
655  return GWEN_IdList64__GetNextId(idl, pos);
656 }
657 #endif // ifndef NO_DEPRECATED_SYMBOLS
658 
659 
660 
661 
662 
663 
666 
667  assert(idl);
669 
671  it->list=idl;
672 
673  return it;
674 }
675 
676 
677 
679  if (it) {
680  GWEN_IdList64_free(it->list);
681  GWEN_FREE_OBJECT(it);
682  }
683 }
684 
685 
686 
688  return GWEN_IdList64__GetFirstId(it->list, &(it->nextIndex));
689 }
690 
691 
692 
694  return GWEN_IdList64__GetNextId(it->list, &(it->nextIndex));
695 }
696 
697 
698 
699 int GWEN_IdList64_AppendId(GWEN_IDLIST64 *idl, uint64_t id) {
700  GWEN_IDTABLE64 *idt=NULL;
701 
702  assert(idl);
703 
704  if (idl->pIdTablePointers==NULL) {
705  /* create an initial pointer table which can take up to GWEN_IDLIST64_STEP pointers */
706  idl->pIdTablePointers=(GWEN_IDTABLE64 **) malloc(sizeof(GWEN_IDTABLE64*)*GWEN_IDLIST64_STEP);
707  assert(idl->pIdTablePointers);
708  memset(idl->pIdTablePointers, 0, sizeof(GWEN_IDTABLE64*)*GWEN_IDLIST64_STEP);
709  idl->idTableCount=GWEN_IDLIST64_STEP;
710  }
711 
712  assert(idl->lastTableIdx<idl->idTableCount);
713  idt=idl->pIdTablePointers[idl->lastTableIdx];
714  if (idt==NULL || GWEN_IdTable64_IsFull(idt)) {
715  idt=GWEN_IdTable64_new();
716  GWEN_IdList64_AddTable(idl, idt);
717  }
718 
719  GWEN_IdTable64_AppendId(idt, id);
720  idl->entryCount++;
721  return 0;
722 }
723 
724 
725 
726 uint64_t GWEN_IdList64_GetIdAt(const GWEN_IDLIST64 *idl, uint64_t idx) {
727  GWEN_IDTABLE64 *idt;
728  uint64_t tableNum=idx / GWEN_IDTABLE64_MAXENTRIES;
729  uint64_t tableIdx=idx % GWEN_IDTABLE64_MAXENTRIES;
730 
731  assert(idl);
732  if (tableNum>idl->idTableCount) {
733  DBG_INFO(GWEN_LOGDOMAIN, "Table index out of range");
734  return 0;
735  }
736 
737  idt=idl->pIdTablePointers[tableNum];
738  if (idt==NULL) {
739  DBG_INFO(GWEN_LOGDOMAIN, "Table index points to an empty table");
740  return 0;
741  }
742 
743  return idt->entries[tableIdx];
744 }
745 
746 
747 
748 
749 
750 
751 
752 
753 
754 
755 
uint64_t GWEN_IdList64_GetFirstId2(const GWEN_IDLIST64 *idl, uint64_t *pos)
Definition: idlist64.c:648
int GWEN_IdList64_HasId(const GWEN_IDLIST64 *idl, uint64_t id)
Definition: idlist64.c:371
GWEN_IDLIST64_ITERATOR * GWEN_IdList64_Iterator_new(GWEN_IDLIST64 *idl)
Definition: idlist64.c:664
#define GWEN_FREE_OBJECT(varname)
Definition: memory.h:92
#define NULL
Definition: binreloc.c:290
#define GWEN_LOGDOMAIN
Definition: logger.h:35
static int GWEN_IdTable64_DelId(GWEN_IDTABLE64 *idt, uint64_t id)
Definition: idlist64.c:126
static int GWEN_IdTable64_HasId(const GWEN_IDTABLE64 *idt, uint64_t id)
Definition: idlist64.c:113
int GWEN_IdList64_DelId(GWEN_IDLIST64 *idl, uint64_t id)
Definition: idlist64.c:349
static int __compDescending(const void *pa, const void *pb)
Definition: idlist64.c:441
int GWEN_IdList64_Sort(GWEN_IDLIST64 *idl)
Definition: idlist64.c:505
void GWEN_IdList64_free(GWEN_IDLIST64 *idl)
Definition: idlist64.c:241
void GWEN_IdList64_Iterator_free(GWEN_IDLIST64_ITERATOR *it)
Definition: idlist64.c:678
static int GWEN_IdTable64_AddId(GWEN_IDTABLE64 *idt, uint64_t id)
Definition: idlist64.c:83
uint64_t GWEN_IdList64_GetFirstId(GWEN_IDLIST64 *idl)
Definition: idlist64.c:636
uint64_t GWEN_IdList64_GetEntryCount(const GWEN_IDLIST64 *idl)
Definition: idlist64.c:546
static int GWEN_IdList64__Sort(GWEN_IDLIST64 *idl, int ascending)
Definition: idlist64.c:455
uint64_t GWEN_IdList64__GetNextId(const GWEN_IDLIST64 *idl, uint64_t *pos)
Definition: idlist64.c:584
#define GWEN_NEW_OBJECT(typ, varname)
Definition: memory.h:86
GWEN_IDTABLE64 * GWEN_IdTable64_new(void)
Definition: idlist64.c:50
static int GWEN_IdTable64_IsFull(const GWEN_IDTABLE64 *idt)
Definition: idlist64.c:147
void GWEN_IdList64_AddTable(GWEN_IDLIST64 *idl, GWEN_IDTABLE64 *idt)
Definition: idlist64.c:256
uint64_t GWEN_IdList64_Iterator_GetFirstId(GWEN_IDLIST64_ITERATOR *it)
Definition: idlist64.c:687
uint64_t GWEN_IdList64_GetNextId(GWEN_IDLIST64 *idl)
Definition: idlist64.c:642
int GWEN_IdList64_AddId(GWEN_IDLIST64 *idl, uint64_t id)
Definition: idlist64.c:293
static int __compAscending(const void *pa, const void *pb)
Definition: idlist64.c:427
int GWEN_IdList64_AppendId(GWEN_IDLIST64 *idl, uint64_t id)
Definition: idlist64.c:699
#define DBG_ERROR(dbg_logger, format, args...)
Definition: debug.h:97
GWEN_IDLIST64 * GWEN_IdList64_dup(const GWEN_IDLIST64 *idl)
Definition: idlist64.c:517
void GWEN_IdList64_Clear(GWEN_IDLIST64 *idl)
Definition: idlist64.c:405
#define DBG_INFO(dbg_logger, format, args...)
Definition: debug.h:164
void GWEN_IdList64_Attach(GWEN_IDLIST64 *idl)
Definition: idlist64.c:233
GWEN_IDLIST64 * GWEN_IdList64_new(void)
Definition: idlist64.c:223
static int GWEN_IdTable64_IsEmpty(const GWEN_IDTABLE64 *idt)
Definition: idlist64.c:141
void GWEN_IdList64_Clean(GWEN_IDLIST64 *idl)
Definition: idlist64.c:389
uint64_t GWEN_IdList64_Iterator_GetNextId(GWEN_IDLIST64_ITERATOR *it)
Definition: idlist64.c:693
static int GWEN_IdTable64_AppendId(GWEN_IDTABLE64 *idt, uint64_t id)
Definition: idlist64.c:98
uint64_t GWEN_IdList64__GetFirstId(const GWEN_IDLIST64 *idl, uint64_t *pos)
Definition: idlist64.c:555
void GWEN_IdTable64_free(GWEN_IDTABLE64 *idt)
Definition: idlist64.c:62
uint64_t GWEN_IdList64_GetNextId2(const GWEN_IDLIST64 *idl, uint64_t *pos)
Definition: idlist64.c:654
uint64_t GWEN_IdList64_GetIdAt(const GWEN_IDLIST64 *idl, uint64_t idx)
Definition: idlist64.c:726
struct GWEN_IDLIST64_ITERATOR GWEN_IDLIST64_ITERATOR
Definition: idlist64.h:37
struct GWEN_IDLIST64 GWEN_IDLIST64
Definition: idlist64.h:36
int GWEN_IdList64_ReverseSort(GWEN_IDLIST64 *idl)
Definition: idlist64.c:511