nokolexbor 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/nokolexbor/extconf.rb +12 -6
- data/ext/nokolexbor/libxml/SAX2.h +4 -4
- data/ext/nokolexbor/libxml/chvalid.h +21 -21
- data/ext/nokolexbor/libxml/dict.h +13 -13
- data/ext/nokolexbor/libxml/globals.h +202 -202
- data/ext/nokolexbor/libxml/hash.h +25 -25
- data/ext/nokolexbor/libxml/parser.h +5 -5
- data/ext/nokolexbor/libxml/parserInternals.h +4 -4
- data/ext/nokolexbor/libxml/pattern.h +14 -14
- data/ext/nokolexbor/libxml/threads.h +15 -15
- data/ext/nokolexbor/libxml/tree.h +5 -5
- data/ext/nokolexbor/libxml/xmlerror.h +5 -5
- data/ext/nokolexbor/libxml/xmlmemory.h +16 -16
- data/ext/nokolexbor/libxml/xmlstring.h +30 -30
- data/ext/nokolexbor/libxml/xpath.h +43 -43
- data/ext/nokolexbor/libxml/xpathInternals.h +128 -128
- data/ext/nokolexbor/memory.c +7 -0
- data/ext/nokolexbor/nl_document.c +11 -1
- data/ext/nokolexbor/nl_node.c +37 -16
- data/ext/nokolexbor/nl_node_set.c +23 -9
- data/ext/nokolexbor/nl_xpath_context.c +19 -14
- data/ext/nokolexbor/private/buf.h +1 -1
- data/ext/nokolexbor/private/error.h +3 -3
- data/ext/nokolexbor/xml_SAX2.c +8 -8
- data/ext/nokolexbor/xml_buf.c +19 -19
- data/ext/nokolexbor/xml_chvalid.c +25 -25
- data/ext/nokolexbor/xml_dict.c +69 -69
- data/ext/nokolexbor/xml_encoding.c +2 -2
- data/ext/nokolexbor/xml_error.c +51 -51
- data/ext/nokolexbor/xml_globals.c +329 -329
- data/ext/nokolexbor/xml_hash.c +131 -131
- data/ext/nokolexbor/xml_memory.c +25 -25
- data/ext/nokolexbor/xml_parser.c +3 -3
- data/ext/nokolexbor/xml_parserInternals.c +15 -15
- data/ext/nokolexbor/xml_pattern.c +103 -103
- data/ext/nokolexbor/xml_string.c +93 -93
- data/ext/nokolexbor/xml_threads.c +61 -61
- data/ext/nokolexbor/xml_tree.c +12 -12
- data/ext/nokolexbor/xml_xpath.c +1194 -1203
- data/lib/nokolexbor/version.rb +1 -1
- data/patches/0003-lexbor-attach-template-content-to-self.patch +13 -0
- metadata +2 -2
data/ext/nokolexbor/xml_hash.c
CHANGED
@@ -167,7 +167,7 @@ xmlHashComputeQKey(xmlHashTablePtr table,
|
|
167
167
|
}
|
168
168
|
|
169
169
|
/**
|
170
|
-
*
|
170
|
+
* nl_xmlHashCreate:
|
171
171
|
* @size: the size of the hash table
|
172
172
|
*
|
173
173
|
* Create a new xmlHashTablePtr.
|
@@ -175,18 +175,18 @@ xmlHashComputeQKey(xmlHashTablePtr table,
|
|
175
175
|
* Returns the newly created object, or NULL if an error occurred.
|
176
176
|
*/
|
177
177
|
xmlHashTablePtr
|
178
|
-
|
178
|
+
nl_xmlHashCreate(int size) {
|
179
179
|
xmlHashTablePtr table;
|
180
180
|
|
181
181
|
if (size <= 0)
|
182
182
|
size = 256;
|
183
183
|
|
184
|
-
table =
|
184
|
+
table = nl_xmlMalloc(sizeof(xmlHashTable));
|
185
185
|
if (table) {
|
186
186
|
table->dict = NULL;
|
187
187
|
table->size = size;
|
188
188
|
table->nbElems = 0;
|
189
|
-
table->table =
|
189
|
+
table->table = nl_xmlMalloc(size * sizeof(xmlHashEntry));
|
190
190
|
if (table->table) {
|
191
191
|
memset(table->table, 0, size * sizeof(xmlHashEntry));
|
192
192
|
#ifdef HASH_RANDOMIZATION
|
@@ -194,13 +194,13 @@ xmlHashCreate(int size) {
|
|
194
194
|
#endif
|
195
195
|
return(table);
|
196
196
|
}
|
197
|
-
|
197
|
+
nl_xmlFree(table);
|
198
198
|
}
|
199
199
|
return(NULL);
|
200
200
|
}
|
201
201
|
|
202
202
|
/**
|
203
|
-
*
|
203
|
+
* nl_xmlHashCreateDict:
|
204
204
|
* @size: the size of the hash table
|
205
205
|
* @dict: a dictionary to use for the hash
|
206
206
|
*
|
@@ -209,13 +209,13 @@ xmlHashCreate(int size) {
|
|
209
209
|
* Returns the newly created object, or NULL if an error occurred.
|
210
210
|
*/
|
211
211
|
xmlHashTablePtr
|
212
|
-
|
212
|
+
nl_xmlHashCreateDict(int size, xmlDictPtr dict) {
|
213
213
|
xmlHashTablePtr table;
|
214
214
|
|
215
|
-
table =
|
215
|
+
table = nl_xmlHashCreate(size);
|
216
216
|
if (table != NULL) {
|
217
217
|
table->dict = dict;
|
218
|
-
|
218
|
+
nl_xmlDictReference(dict);
|
219
219
|
}
|
220
220
|
return(table);
|
221
221
|
}
|
@@ -251,7 +251,7 @@ xmlHashGrow(xmlHashTablePtr table, int size) {
|
|
251
251
|
if (oldtable == NULL)
|
252
252
|
return(-1);
|
253
253
|
|
254
|
-
table->table =
|
254
|
+
table->table = nl_xmlMalloc(size * sizeof(xmlHashEntry));
|
255
255
|
if (table->table == NULL) {
|
256
256
|
table->table = oldtable;
|
257
257
|
return(-1);
|
@@ -288,7 +288,7 @@ xmlHashGrow(xmlHashTablePtr table, int size) {
|
|
288
288
|
if (table->table[key].valid == 0) {
|
289
289
|
memcpy(&(table->table[key]), iter, sizeof(xmlHashEntry));
|
290
290
|
table->table[key].next = NULL;
|
291
|
-
|
291
|
+
nl_xmlFree(iter);
|
292
292
|
} else {
|
293
293
|
iter->next = table->table[key].next;
|
294
294
|
table->table[key].next = iter;
|
@@ -302,10 +302,10 @@ xmlHashGrow(xmlHashTablePtr table, int size) {
|
|
302
302
|
}
|
303
303
|
}
|
304
304
|
|
305
|
-
|
305
|
+
nl_xmlFree(oldtable);
|
306
306
|
|
307
307
|
#ifdef DEBUG_GROW
|
308
|
-
|
308
|
+
nl_xmlGenericError(nl_xmlGenericErrorContext,
|
309
309
|
"xmlHashGrow : from %d to %d, %d elems\n", oldsize, size, nbElem);
|
310
310
|
#endif
|
311
311
|
|
@@ -313,7 +313,7 @@ xmlHashGrow(xmlHashTablePtr table, int size) {
|
|
313
313
|
}
|
314
314
|
|
315
315
|
/**
|
316
|
-
*
|
316
|
+
* nl_xmlHashFree:
|
317
317
|
* @table: the hash table
|
318
318
|
* @f: the deallocator function for items in the hash
|
319
319
|
*
|
@@ -321,7 +321,7 @@ xmlHashGrow(xmlHashTablePtr table, int size) {
|
|
321
321
|
* deallocated with @f if provided.
|
322
322
|
*/
|
323
323
|
void
|
324
|
-
|
324
|
+
nl_xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f) {
|
325
325
|
int i;
|
326
326
|
xmlHashEntryPtr iter;
|
327
327
|
xmlHashEntryPtr next;
|
@@ -343,41 +343,41 @@ xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f) {
|
|
343
343
|
f(iter->payload, iter->name);
|
344
344
|
if (table->dict == NULL) {
|
345
345
|
if (iter->name)
|
346
|
-
|
346
|
+
nl_xmlFree(iter->name);
|
347
347
|
if (iter->name2)
|
348
|
-
|
348
|
+
nl_xmlFree(iter->name2);
|
349
349
|
if (iter->name3)
|
350
|
-
|
350
|
+
nl_xmlFree(iter->name3);
|
351
351
|
}
|
352
352
|
iter->payload = NULL;
|
353
353
|
if (!inside_table)
|
354
|
-
|
354
|
+
nl_xmlFree(iter);
|
355
355
|
nbElems--;
|
356
356
|
inside_table = 0;
|
357
357
|
iter = next;
|
358
358
|
}
|
359
359
|
}
|
360
|
-
|
360
|
+
nl_xmlFree(table->table);
|
361
361
|
}
|
362
362
|
if (table->dict)
|
363
|
-
|
364
|
-
|
363
|
+
nl_xmlDictFree(table->dict);
|
364
|
+
nl_xmlFree(table);
|
365
365
|
}
|
366
366
|
|
367
367
|
/**
|
368
|
-
*
|
368
|
+
* nl_xmlHashDefaultDeallocator:
|
369
369
|
* @entry: the hash table entry
|
370
370
|
* @name: the entry's name
|
371
371
|
*
|
372
|
-
* Free a hash table entry with
|
372
|
+
* Free a hash table entry with nl_xmlFree.
|
373
373
|
*/
|
374
374
|
void
|
375
|
-
|
376
|
-
|
375
|
+
nl_xmlHashDefaultDeallocator(void *entry, const xmlChar *name ATTRIBUTE_UNUSED) {
|
376
|
+
nl_xmlFree(entry);
|
377
377
|
}
|
378
378
|
|
379
379
|
/**
|
380
|
-
*
|
380
|
+
* nl_xmlHashAddEntry:
|
381
381
|
* @table: the hash table
|
382
382
|
* @name: the name of the userdata
|
383
383
|
* @userdata: a pointer to the userdata
|
@@ -388,12 +388,12 @@ xmlHashDefaultDeallocator(void *entry, const xmlChar *name ATTRIBUTE_UNUSED) {
|
|
388
388
|
* Returns 0 the addition succeeded and -1 in case of error.
|
389
389
|
*/
|
390
390
|
int
|
391
|
-
|
392
|
-
return(
|
391
|
+
nl_xmlHashAddEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata) {
|
392
|
+
return(nl_xmlHashAddEntry3(table, name, NULL, NULL, userdata));
|
393
393
|
}
|
394
394
|
|
395
395
|
/**
|
396
|
-
*
|
396
|
+
* nl_xmlHashAddEntry2:
|
397
397
|
* @table: the hash table
|
398
398
|
* @name: the name of the userdata
|
399
399
|
* @name2: a second name of the userdata
|
@@ -405,13 +405,13 @@ xmlHashAddEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata) {
|
|
405
405
|
* Returns 0 the addition succeeded and -1 in case of error.
|
406
406
|
*/
|
407
407
|
int
|
408
|
-
|
408
|
+
nl_xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name,
|
409
409
|
const xmlChar *name2, void *userdata) {
|
410
|
-
return(
|
410
|
+
return(nl_xmlHashAddEntry3(table, name, name2, NULL, userdata));
|
411
411
|
}
|
412
412
|
|
413
413
|
/**
|
414
|
-
*
|
414
|
+
* nl_xmlHashUpdateEntry:
|
415
415
|
* @table: the hash table
|
416
416
|
* @name: the name of the userdata
|
417
417
|
* @userdata: a pointer to the userdata
|
@@ -424,13 +424,13 @@ xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name,
|
|
424
424
|
* Returns 0 the addition succeeded and -1 in case of error.
|
425
425
|
*/
|
426
426
|
int
|
427
|
-
|
427
|
+
nl_xmlHashUpdateEntry(xmlHashTablePtr table, const xmlChar *name,
|
428
428
|
void *userdata, xmlHashDeallocator f) {
|
429
|
-
return(
|
429
|
+
return(nl_xmlHashUpdateEntry3(table, name, NULL, NULL, userdata, f));
|
430
430
|
}
|
431
431
|
|
432
432
|
/**
|
433
|
-
*
|
433
|
+
* nl_xmlHashUpdateEntry2:
|
434
434
|
* @table: the hash table
|
435
435
|
* @name: the name of the userdata
|
436
436
|
* @name2: a second name of the userdata
|
@@ -444,14 +444,14 @@ xmlHashUpdateEntry(xmlHashTablePtr table, const xmlChar *name,
|
|
444
444
|
* Returns 0 the addition succeeded and -1 in case of error.
|
445
445
|
*/
|
446
446
|
int
|
447
|
-
|
447
|
+
nl_xmlHashUpdateEntry2(xmlHashTablePtr table, const xmlChar *name,
|
448
448
|
const xmlChar *name2, void *userdata,
|
449
449
|
xmlHashDeallocator f) {
|
450
|
-
return(
|
450
|
+
return(nl_xmlHashUpdateEntry3(table, name, name2, NULL, userdata, f));
|
451
451
|
}
|
452
452
|
|
453
453
|
/**
|
454
|
-
*
|
454
|
+
* nl_xmlHashLookup:
|
455
455
|
* @table: the hash table
|
456
456
|
* @name: the name of the userdata
|
457
457
|
*
|
@@ -460,12 +460,12 @@ xmlHashUpdateEntry2(xmlHashTablePtr table, const xmlChar *name,
|
|
460
460
|
* Returns the pointer to the userdata
|
461
461
|
*/
|
462
462
|
void *
|
463
|
-
|
464
|
-
return(
|
463
|
+
nl_xmlHashLookup(xmlHashTablePtr table, const xmlChar *name) {
|
464
|
+
return(nl_xmlHashLookup3(table, name, NULL, NULL));
|
465
465
|
}
|
466
466
|
|
467
467
|
/**
|
468
|
-
*
|
468
|
+
* nl_xmlHashLookup2:
|
469
469
|
* @table: the hash table
|
470
470
|
* @name: the name of the userdata
|
471
471
|
* @name2: a second name of the userdata
|
@@ -475,13 +475,13 @@ xmlHashLookup(xmlHashTablePtr table, const xmlChar *name) {
|
|
475
475
|
* Returns the pointer to the userdata
|
476
476
|
*/
|
477
477
|
void *
|
478
|
-
|
478
|
+
nl_xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name,
|
479
479
|
const xmlChar *name2) {
|
480
|
-
return(
|
480
|
+
return(nl_xmlHashLookup3(table, name, name2, NULL));
|
481
481
|
}
|
482
482
|
|
483
483
|
/**
|
484
|
-
*
|
484
|
+
* nl_xmlHashQLookup:
|
485
485
|
* @table: the hash table
|
486
486
|
* @prefix: the prefix of the userdata
|
487
487
|
* @name: the name of the userdata
|
@@ -491,13 +491,13 @@ xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name,
|
|
491
491
|
* Returns the pointer to the userdata
|
492
492
|
*/
|
493
493
|
void *
|
494
|
-
|
494
|
+
nl_xmlHashQLookup(xmlHashTablePtr table, const xmlChar *prefix,
|
495
495
|
const xmlChar *name) {
|
496
|
-
return(
|
496
|
+
return(nl_xmlHashQLookup3(table, prefix, name, NULL, NULL, NULL, NULL));
|
497
497
|
}
|
498
498
|
|
499
499
|
/**
|
500
|
-
*
|
500
|
+
* nl_xmlHashQLookup2:
|
501
501
|
* @table: the hash table
|
502
502
|
* @prefix: the prefix of the userdata
|
503
503
|
* @name: the name of the userdata
|
@@ -509,14 +509,14 @@ xmlHashQLookup(xmlHashTablePtr table, const xmlChar *prefix,
|
|
509
509
|
* Returns the pointer to the userdata
|
510
510
|
*/
|
511
511
|
void *
|
512
|
-
|
512
|
+
nl_xmlHashQLookup2(xmlHashTablePtr table, const xmlChar *prefix,
|
513
513
|
const xmlChar *name, const xmlChar *prefix2,
|
514
514
|
const xmlChar *name2) {
|
515
|
-
return(
|
515
|
+
return(nl_xmlHashQLookup3(table, prefix, name, prefix2, name2, NULL, NULL));
|
516
516
|
}
|
517
517
|
|
518
518
|
/**
|
519
|
-
*
|
519
|
+
* nl_xmlHashAddEntry3:
|
520
520
|
* @table: the hash table
|
521
521
|
* @name: the name of the userdata
|
522
522
|
* @name2: a second name of the userdata
|
@@ -530,7 +530,7 @@ xmlHashQLookup2(xmlHashTablePtr table, const xmlChar *prefix,
|
|
530
530
|
* Returns 0 the addition succeeded and -1 in case of error.
|
531
531
|
*/
|
532
532
|
int
|
533
|
-
|
533
|
+
nl_xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name,
|
534
534
|
const xmlChar *name2, const xmlChar *name3,
|
535
535
|
void *userdata) {
|
536
536
|
unsigned long key, len = 0;
|
@@ -544,18 +544,18 @@ xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name,
|
|
544
544
|
* If using a dict internalize if needed
|
545
545
|
*/
|
546
546
|
if (table->dict) {
|
547
|
-
if (!
|
548
|
-
name =
|
547
|
+
if (!nl_xmlDictOwns(table->dict, name)) {
|
548
|
+
name = nl_xmlDictLookup(table->dict, name, -1);
|
549
549
|
if (name == NULL)
|
550
550
|
return(-1);
|
551
551
|
}
|
552
|
-
if ((name2 != NULL) && (!
|
553
|
-
name2 =
|
552
|
+
if ((name2 != NULL) && (!nl_xmlDictOwns(table->dict, name2))) {
|
553
|
+
name2 = nl_xmlDictLookup(table->dict, name2, -1);
|
554
554
|
if (name2 == NULL)
|
555
555
|
return(-1);
|
556
556
|
}
|
557
|
-
if ((name3 != NULL) && (!
|
558
|
-
name3 =
|
557
|
+
if ((name3 != NULL) && (!nl_xmlDictOwns(table->dict, name3))) {
|
558
|
+
name3 = nl_xmlDictLookup(table->dict, name3, -1);
|
559
559
|
if (name3 == NULL)
|
560
560
|
return(-1);
|
561
561
|
}
|
@@ -584,15 +584,15 @@ xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name,
|
|
584
584
|
} else {
|
585
585
|
for (insert = &(table->table[key]); insert->next != NULL;
|
586
586
|
insert = insert->next) {
|
587
|
-
if ((
|
588
|
-
(
|
589
|
-
(
|
587
|
+
if ((nl_xmlStrEqual(insert->name, name)) &&
|
588
|
+
(nl_xmlStrEqual(insert->name2, name2)) &&
|
589
|
+
(nl_xmlStrEqual(insert->name3, name3)))
|
590
590
|
return(-1);
|
591
591
|
len++;
|
592
592
|
}
|
593
|
-
if ((
|
594
|
-
(
|
595
|
-
(
|
593
|
+
if ((nl_xmlStrEqual(insert->name, name)) &&
|
594
|
+
(nl_xmlStrEqual(insert->name2, name2)) &&
|
595
|
+
(nl_xmlStrEqual(insert->name3, name3)))
|
596
596
|
return(-1);
|
597
597
|
}
|
598
598
|
}
|
@@ -600,7 +600,7 @@ xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name,
|
|
600
600
|
if (insert == NULL) {
|
601
601
|
entry = &(table->table[key]);
|
602
602
|
} else {
|
603
|
-
entry =
|
603
|
+
entry = nl_xmlMalloc(sizeof(xmlHashEntry));
|
604
604
|
if (entry == NULL)
|
605
605
|
return(-1);
|
606
606
|
}
|
@@ -610,9 +610,9 @@ xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name,
|
|
610
610
|
entry->name2 = (xmlChar *) name2;
|
611
611
|
entry->name3 = (xmlChar *) name3;
|
612
612
|
} else {
|
613
|
-
entry->name =
|
614
|
-
entry->name2 =
|
615
|
-
entry->name3 =
|
613
|
+
entry->name = nl_xmlStrdup(name);
|
614
|
+
entry->name2 = nl_xmlStrdup(name2);
|
615
|
+
entry->name3 = nl_xmlStrdup(name3);
|
616
616
|
}
|
617
617
|
entry->payload = userdata;
|
618
618
|
entry->next = NULL;
|
@@ -631,7 +631,7 @@ xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name,
|
|
631
631
|
}
|
632
632
|
|
633
633
|
/**
|
634
|
-
*
|
634
|
+
* nl_xmlHashUpdateEntry3:
|
635
635
|
* @table: the hash table
|
636
636
|
* @name: the name of the userdata
|
637
637
|
* @name2: a second name of the userdata
|
@@ -646,7 +646,7 @@ xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name,
|
|
646
646
|
* Returns 0 the addition succeeded and -1 in case of error.
|
647
647
|
*/
|
648
648
|
int
|
649
|
-
|
649
|
+
nl_xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name,
|
650
650
|
const xmlChar *name2, const xmlChar *name3,
|
651
651
|
void *userdata, xmlHashDeallocator f) {
|
652
652
|
unsigned long key;
|
@@ -660,18 +660,18 @@ xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name,
|
|
660
660
|
* If using a dict internalize if needed
|
661
661
|
*/
|
662
662
|
if (table->dict) {
|
663
|
-
if (!
|
664
|
-
name =
|
663
|
+
if (!nl_xmlDictOwns(table->dict, name)) {
|
664
|
+
name = nl_xmlDictLookup(table->dict, name, -1);
|
665
665
|
if (name == NULL)
|
666
666
|
return(-1);
|
667
667
|
}
|
668
|
-
if ((name2 != NULL) && (!
|
669
|
-
name2 =
|
668
|
+
if ((name2 != NULL) && (!nl_xmlDictOwns(table->dict, name2))) {
|
669
|
+
name2 = nl_xmlDictLookup(table->dict, name2, -1);
|
670
670
|
if (name2 == NULL)
|
671
671
|
return(-1);
|
672
672
|
}
|
673
|
-
if ((name3 != NULL) && (!
|
674
|
-
name3 =
|
673
|
+
if ((name3 != NULL) && (!nl_xmlDictOwns(table->dict, name3))) {
|
674
|
+
name3 = nl_xmlDictLookup(table->dict, name3, -1);
|
675
675
|
if (name3 == NULL)
|
676
676
|
return(-1);
|
677
677
|
}
|
@@ -707,18 +707,18 @@ xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name,
|
|
707
707
|
} else {
|
708
708
|
for (insert = &(table->table[key]); insert->next != NULL;
|
709
709
|
insert = insert->next) {
|
710
|
-
if ((
|
711
|
-
(
|
712
|
-
(
|
710
|
+
if ((nl_xmlStrEqual(insert->name, name)) &&
|
711
|
+
(nl_xmlStrEqual(insert->name2, name2)) &&
|
712
|
+
(nl_xmlStrEqual(insert->name3, name3))) {
|
713
713
|
if (f)
|
714
714
|
f(insert->payload, insert->name);
|
715
715
|
insert->payload = userdata;
|
716
716
|
return(0);
|
717
717
|
}
|
718
718
|
}
|
719
|
-
if ((
|
720
|
-
(
|
721
|
-
(
|
719
|
+
if ((nl_xmlStrEqual(insert->name, name)) &&
|
720
|
+
(nl_xmlStrEqual(insert->name2, name2)) &&
|
721
|
+
(nl_xmlStrEqual(insert->name3, name3))) {
|
722
722
|
if (f)
|
723
723
|
f(insert->payload, insert->name);
|
724
724
|
insert->payload = userdata;
|
@@ -730,7 +730,7 @@ xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name,
|
|
730
730
|
if (insert == NULL) {
|
731
731
|
entry = &(table->table[key]);
|
732
732
|
} else {
|
733
|
-
entry =
|
733
|
+
entry = nl_xmlMalloc(sizeof(xmlHashEntry));
|
734
734
|
if (entry == NULL)
|
735
735
|
return(-1);
|
736
736
|
}
|
@@ -740,9 +740,9 @@ xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name,
|
|
740
740
|
entry->name2 = (xmlChar *) name2;
|
741
741
|
entry->name3 = (xmlChar *) name3;
|
742
742
|
} else {
|
743
|
-
entry->name =
|
744
|
-
entry->name2 =
|
745
|
-
entry->name3 =
|
743
|
+
entry->name = nl_xmlStrdup(name);
|
744
|
+
entry->name2 = nl_xmlStrdup(name2);
|
745
|
+
entry->name3 = nl_xmlStrdup(name3);
|
746
746
|
}
|
747
747
|
entry->payload = userdata;
|
748
748
|
entry->next = NULL;
|
@@ -757,7 +757,7 @@ xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name,
|
|
757
757
|
}
|
758
758
|
|
759
759
|
/**
|
760
|
-
*
|
760
|
+
* nl_xmlHashLookup3:
|
761
761
|
* @table: the hash table
|
762
762
|
* @name: the name of the userdata
|
763
763
|
* @name2: a second name of the userdata
|
@@ -768,7 +768,7 @@ xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name,
|
|
768
768
|
* Returns the a pointer to the userdata
|
769
769
|
*/
|
770
770
|
void *
|
771
|
-
|
771
|
+
nl_xmlHashLookup3(xmlHashTablePtr table, const xmlChar *name,
|
772
772
|
const xmlChar *name2, const xmlChar *name3) {
|
773
773
|
unsigned long key;
|
774
774
|
xmlHashEntryPtr entry;
|
@@ -789,16 +789,16 @@ xmlHashLookup3(xmlHashTablePtr table, const xmlChar *name,
|
|
789
789
|
}
|
790
790
|
}
|
791
791
|
for (entry = &(table->table[key]); entry != NULL; entry = entry->next) {
|
792
|
-
if ((
|
793
|
-
(
|
794
|
-
(
|
792
|
+
if ((nl_xmlStrEqual(entry->name, name)) &&
|
793
|
+
(nl_xmlStrEqual(entry->name2, name2)) &&
|
794
|
+
(nl_xmlStrEqual(entry->name3, name3)))
|
795
795
|
return(entry->payload);
|
796
796
|
}
|
797
797
|
return(NULL);
|
798
798
|
}
|
799
799
|
|
800
800
|
/**
|
801
|
-
*
|
801
|
+
* nl_xmlHashQLookup3:
|
802
802
|
* @table: the hash table
|
803
803
|
* @prefix: the prefix of the userdata
|
804
804
|
* @name: the name of the userdata
|
@@ -812,7 +812,7 @@ xmlHashLookup3(xmlHashTablePtr table, const xmlChar *name,
|
|
812
812
|
* Returns the a pointer to the userdata
|
813
813
|
*/
|
814
814
|
void *
|
815
|
-
|
815
|
+
nl_xmlHashQLookup3(xmlHashTablePtr table,
|
816
816
|
const xmlChar *prefix, const xmlChar *name,
|
817
817
|
const xmlChar *prefix2, const xmlChar *name2,
|
818
818
|
const xmlChar *prefix3, const xmlChar *name3) {
|
@@ -828,9 +828,9 @@ xmlHashQLookup3(xmlHashTablePtr table,
|
|
828
828
|
if (table->table[key].valid == 0)
|
829
829
|
return(NULL);
|
830
830
|
for (entry = &(table->table[key]); entry != NULL; entry = entry->next) {
|
831
|
-
if ((
|
832
|
-
(
|
833
|
-
(
|
831
|
+
if ((nl_xmlStrQEqual(prefix, name, entry->name)) &&
|
832
|
+
(nl_xmlStrQEqual(prefix2, name2, entry->name2)) &&
|
833
|
+
(nl_xmlStrQEqual(prefix3, name3, entry->name3)))
|
834
834
|
return(entry->payload);
|
835
835
|
}
|
836
836
|
return(NULL);
|
@@ -850,7 +850,7 @@ stubHashScannerFull (void *payload, void *data, const xmlChar *name,
|
|
850
850
|
}
|
851
851
|
|
852
852
|
/**
|
853
|
-
*
|
853
|
+
* nl_xmlHashScan:
|
854
854
|
* @table: the hash table
|
855
855
|
* @f: the scanner function for items in the hash
|
856
856
|
* @data: extra data passed to f
|
@@ -858,15 +858,15 @@ stubHashScannerFull (void *payload, void *data, const xmlChar *name,
|
|
858
858
|
* Scan the hash @table and applied @f to each value.
|
859
859
|
*/
|
860
860
|
void
|
861
|
-
|
861
|
+
nl_xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data) {
|
862
862
|
stubData stubdata;
|
863
863
|
stubdata.data = data;
|
864
864
|
stubdata.hashscanner = f;
|
865
|
-
|
865
|
+
nl_xmlHashScanFull (table, stubHashScannerFull, &stubdata);
|
866
866
|
}
|
867
867
|
|
868
868
|
/**
|
869
|
-
*
|
869
|
+
* nl_xmlHashScanFull:
|
870
870
|
* @table: the hash table
|
871
871
|
* @f: the scanner function for items in the hash
|
872
872
|
* @data: extra data passed to f
|
@@ -874,7 +874,7 @@ xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data) {
|
|
874
874
|
* Scan the hash @table and applied @f to each value.
|
875
875
|
*/
|
876
876
|
void
|
877
|
-
|
877
|
+
nl_xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data) {
|
878
878
|
int i, nb;
|
879
879
|
xmlHashEntryPtr iter;
|
880
880
|
xmlHashEntryPtr next;
|
@@ -912,7 +912,7 @@ xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data) {
|
|
912
912
|
}
|
913
913
|
|
914
914
|
/**
|
915
|
-
*
|
915
|
+
* nl_xmlHashScan3:
|
916
916
|
* @table: the hash table
|
917
917
|
* @name: the name of the userdata or NULL
|
918
918
|
* @name2: a second name of the userdata or NULL
|
@@ -925,18 +925,18 @@ xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data) {
|
|
925
925
|
* the comparison is considered to match.
|
926
926
|
*/
|
927
927
|
void
|
928
|
-
|
928
|
+
nl_xmlHashScan3(xmlHashTablePtr table, const xmlChar *name,
|
929
929
|
const xmlChar *name2, const xmlChar *name3,
|
930
930
|
xmlHashScanner f, void *data) {
|
931
931
|
stubData stubdata;
|
932
932
|
stubdata.data = data;
|
933
933
|
stubdata.hashscanner = f;
|
934
|
-
|
934
|
+
nl_xmlHashScanFull3(table, name, name2, name3, stubHashScannerFull,
|
935
935
|
&stubdata);
|
936
936
|
}
|
937
937
|
|
938
938
|
/**
|
939
|
-
*
|
939
|
+
* nl_xmlHashScanFull3:
|
940
940
|
* @table: the hash table
|
941
941
|
* @name: the name of the userdata or NULL
|
942
942
|
* @name2: a second name of the userdata or NULL
|
@@ -949,7 +949,7 @@ xmlHashScan3(xmlHashTablePtr table, const xmlChar *name,
|
|
949
949
|
* the comparison is considered to match.
|
950
950
|
*/
|
951
951
|
void
|
952
|
-
|
952
|
+
nl_xmlHashScanFull3(xmlHashTablePtr table, const xmlChar *name,
|
953
953
|
const xmlChar *name2, const xmlChar *name3,
|
954
954
|
xmlHashScannerFull f, void *data) {
|
955
955
|
int i;
|
@@ -968,9 +968,9 @@ xmlHashScanFull3(xmlHashTablePtr table, const xmlChar *name,
|
|
968
968
|
iter = &(table->table[i]);
|
969
969
|
while (iter) {
|
970
970
|
next = iter->next;
|
971
|
-
if (((name == NULL) || (
|
972
|
-
((name2 == NULL) || (
|
973
|
-
((name3 == NULL) || (
|
971
|
+
if (((name == NULL) || (nl_xmlStrEqual(name, iter->name))) &&
|
972
|
+
((name2 == NULL) || (nl_xmlStrEqual(name2, iter->name2))) &&
|
973
|
+
((name3 == NULL) || (nl_xmlStrEqual(name3, iter->name3))) &&
|
974
974
|
(iter->payload != NULL)) {
|
975
975
|
f(iter->payload, data, iter->name,
|
976
976
|
iter->name2, iter->name3);
|
@@ -982,7 +982,7 @@ xmlHashScanFull3(xmlHashTablePtr table, const xmlChar *name,
|
|
982
982
|
}
|
983
983
|
|
984
984
|
/**
|
985
|
-
*
|
985
|
+
* nl_xmlHashCopy:
|
986
986
|
* @table: the hash table
|
987
987
|
* @f: the copier function for items in the hash
|
988
988
|
*
|
@@ -991,7 +991,7 @@ xmlHashScanFull3(xmlHashTablePtr table, const xmlChar *name,
|
|
991
991
|
* Returns the new table or NULL in case of error.
|
992
992
|
*/
|
993
993
|
xmlHashTablePtr
|
994
|
-
|
994
|
+
nl_xmlHashCopy(xmlHashTablePtr table, xmlHashCopier f) {
|
995
995
|
int i;
|
996
996
|
xmlHashEntryPtr iter;
|
997
997
|
xmlHashEntryPtr next;
|
@@ -1002,7 +1002,7 @@ xmlHashCopy(xmlHashTablePtr table, xmlHashCopier f) {
|
|
1002
1002
|
if (f == NULL)
|
1003
1003
|
return(NULL);
|
1004
1004
|
|
1005
|
-
ret =
|
1005
|
+
ret = nl_xmlHashCreate(table->size);
|
1006
1006
|
if (ret == NULL)
|
1007
1007
|
return(NULL);
|
1008
1008
|
|
@@ -1013,7 +1013,7 @@ xmlHashCopy(xmlHashTablePtr table, xmlHashCopier f) {
|
|
1013
1013
|
iter = &(table->table[i]);
|
1014
1014
|
while (iter) {
|
1015
1015
|
next = iter->next;
|
1016
|
-
|
1016
|
+
nl_xmlHashAddEntry3(ret, iter->name, iter->name2,
|
1017
1017
|
iter->name3, f(iter->payload, iter->name));
|
1018
1018
|
iter = next;
|
1019
1019
|
}
|
@@ -1024,7 +1024,7 @@ xmlHashCopy(xmlHashTablePtr table, xmlHashCopier f) {
|
|
1024
1024
|
}
|
1025
1025
|
|
1026
1026
|
/**
|
1027
|
-
*
|
1027
|
+
* nl_xmlHashSize:
|
1028
1028
|
* @table: the hash table
|
1029
1029
|
*
|
1030
1030
|
* Query the number of elements installed in the hash @table.
|
@@ -1033,14 +1033,14 @@ xmlHashCopy(xmlHashTablePtr table, xmlHashCopier f) {
|
|
1033
1033
|
* -1 in case of error
|
1034
1034
|
*/
|
1035
1035
|
int
|
1036
|
-
|
1036
|
+
nl_xmlHashSize(xmlHashTablePtr table) {
|
1037
1037
|
if (table == NULL)
|
1038
1038
|
return(-1);
|
1039
1039
|
return(table->nbElems);
|
1040
1040
|
}
|
1041
1041
|
|
1042
1042
|
/**
|
1043
|
-
*
|
1043
|
+
* nl_xmlHashRemoveEntry:
|
1044
1044
|
* @table: the hash table
|
1045
1045
|
* @name: the name of the userdata
|
1046
1046
|
* @f: the deallocator function for removed item (if any)
|
@@ -1051,13 +1051,13 @@ xmlHashSize(xmlHashTablePtr table) {
|
|
1051
1051
|
*
|
1052
1052
|
* Returns 0 if the removal succeeded and -1 in case of error or not found.
|
1053
1053
|
*/
|
1054
|
-
int
|
1054
|
+
int nl_xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name,
|
1055
1055
|
xmlHashDeallocator f) {
|
1056
|
-
return(
|
1056
|
+
return(nl_xmlHashRemoveEntry3(table, name, NULL, NULL, f));
|
1057
1057
|
}
|
1058
1058
|
|
1059
1059
|
/**
|
1060
|
-
*
|
1060
|
+
* nl_xmlHashRemoveEntry2:
|
1061
1061
|
* @table: the hash table
|
1062
1062
|
* @name: the name of the userdata
|
1063
1063
|
* @name2: a second name of the userdata
|
@@ -1070,13 +1070,13 @@ int xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name,
|
|
1070
1070
|
* Returns 0 if the removal succeeded and -1 in case of error or not found.
|
1071
1071
|
*/
|
1072
1072
|
int
|
1073
|
-
|
1073
|
+
nl_xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name,
|
1074
1074
|
const xmlChar *name2, xmlHashDeallocator f) {
|
1075
|
-
return(
|
1075
|
+
return(nl_xmlHashRemoveEntry3(table, name, name2, NULL, f));
|
1076
1076
|
}
|
1077
1077
|
|
1078
1078
|
/**
|
1079
|
-
*
|
1079
|
+
* nl_xmlHashRemoveEntry3:
|
1080
1080
|
* @table: the hash table
|
1081
1081
|
* @name: the name of the userdata
|
1082
1082
|
* @name2: a second name of the userdata
|
@@ -1090,7 +1090,7 @@ xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name,
|
|
1090
1090
|
* Returns 0 if the removal succeeded and -1 in case of error or not found.
|
1091
1091
|
*/
|
1092
1092
|
int
|
1093
|
-
|
1093
|
+
nl_xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name,
|
1094
1094
|
const xmlChar *name2, const xmlChar *name3, xmlHashDeallocator f) {
|
1095
1095
|
unsigned long key;
|
1096
1096
|
xmlHashEntryPtr entry;
|
@@ -1104,30 +1104,30 @@ xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name,
|
|
1104
1104
|
return(-1);
|
1105
1105
|
} else {
|
1106
1106
|
for (entry = &(table->table[key]); entry != NULL; entry = entry->next) {
|
1107
|
-
if (
|
1108
|
-
|
1109
|
-
|
1107
|
+
if (nl_xmlStrEqual(entry->name, name) &&
|
1108
|
+
nl_xmlStrEqual(entry->name2, name2) &&
|
1109
|
+
nl_xmlStrEqual(entry->name3, name3)) {
|
1110
1110
|
if ((f != NULL) && (entry->payload != NULL))
|
1111
1111
|
f(entry->payload, entry->name);
|
1112
1112
|
entry->payload = NULL;
|
1113
1113
|
if (table->dict == NULL) {
|
1114
1114
|
if(entry->name)
|
1115
|
-
|
1115
|
+
nl_xmlFree(entry->name);
|
1116
1116
|
if(entry->name2)
|
1117
|
-
|
1117
|
+
nl_xmlFree(entry->name2);
|
1118
1118
|
if(entry->name3)
|
1119
|
-
|
1119
|
+
nl_xmlFree(entry->name3);
|
1120
1120
|
}
|
1121
1121
|
if(prev) {
|
1122
1122
|
prev->next = entry->next;
|
1123
|
-
|
1123
|
+
nl_xmlFree(entry);
|
1124
1124
|
} else {
|
1125
1125
|
if (entry->next == NULL) {
|
1126
1126
|
entry->valid = 0;
|
1127
1127
|
} else {
|
1128
1128
|
entry = entry->next;
|
1129
1129
|
memcpy(&(table->table[key]), entry, sizeof(xmlHashEntry));
|
1130
|
-
|
1130
|
+
nl_xmlFree(entry);
|
1131
1131
|
}
|
1132
1132
|
}
|
1133
1133
|
table->nbElems--;
|