nokolexbor 0.2.5 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/nokolexbor/CMakeLists.txt +7 -4
- data/ext/nokolexbor/config.h.cmake.in +2 -0
- data/ext/nokolexbor/extconf.rb +47 -25
- 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 +6 -6
- data/ext/nokolexbor/nl_cdata.c +44 -0
- data/ext/nokolexbor/nl_comment.c +44 -0
- data/ext/nokolexbor/nl_document.c +23 -9
- data/ext/nokolexbor/nl_node.c +191 -178
- data/ext/nokolexbor/nl_node_set.c +38 -73
- data/ext/nokolexbor/nl_text.c +44 -0
- data/ext/nokolexbor/nl_xpath_context.c +33 -42
- data/ext/nokolexbor/nokolexbor.c +7 -3
- data/ext/nokolexbor/nokolexbor.h +9 -7
- 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/document.rb +92 -1
- data/lib/nokolexbor/node.rb +64 -0
- data/lib/nokolexbor/node_set.rb +6 -5
- data/lib/nokolexbor/version.rb +1 -1
- data/lib/nokolexbor.rb +21 -1
- data/patches/0001-lexbor-support-text-pseudo-element.patch +1 -1
- metadata +7 -4
data/ext/nokolexbor/xml_dict.c
CHANGED
@@ -142,12 +142,12 @@ static unsigned int rand_seed = 0;
|
|
142
142
|
#endif
|
143
143
|
|
144
144
|
/**
|
145
|
-
*
|
145
|
+
* nl_xmlInitializeDict:
|
146
146
|
*
|
147
|
-
* DEPRECATED: Alias for
|
147
|
+
* DEPRECATED: Alias for nl_xmlInitParser.
|
148
148
|
*/
|
149
|
-
int
|
150
|
-
|
149
|
+
int nl_xmlInitializeDict(void) {
|
150
|
+
nl_xmlInitParser();
|
151
151
|
return(0);
|
152
152
|
}
|
153
153
|
|
@@ -175,19 +175,19 @@ int __xmlInitializeDict(void) {
|
|
175
175
|
int __xmlRandom(void) {
|
176
176
|
int ret;
|
177
177
|
|
178
|
-
|
178
|
+
nl_xmlMutexLock(&xmlDictMutex);
|
179
179
|
#ifdef HAVE_RAND_R
|
180
180
|
ret = rand_r(& rand_seed);
|
181
181
|
#else
|
182
182
|
ret = rand();
|
183
183
|
#endif
|
184
|
-
|
184
|
+
nl_xmlMutexUnlock(&xmlDictMutex);
|
185
185
|
return(ret);
|
186
186
|
}
|
187
187
|
#endif
|
188
188
|
|
189
189
|
/**
|
190
|
-
*
|
190
|
+
* nl_xmlDictCleanup:
|
191
191
|
*
|
192
192
|
* DEPRECATED: This function is a no-op. Call xmlCleanupParser
|
193
193
|
* to free global state but see the warnings there. xmlCleanupParser
|
@@ -195,7 +195,7 @@ int __xmlRandom(void) {
|
|
195
195
|
* have call cleanup functions at all.
|
196
196
|
*/
|
197
197
|
void
|
198
|
-
|
198
|
+
nl_xmlDictCleanup(void) {
|
199
199
|
}
|
200
200
|
|
201
201
|
/**
|
@@ -248,7 +248,7 @@ xmlDictAddString(xmlDictPtr dict, const xmlChar *name, unsigned int namelen) {
|
|
248
248
|
else size *= 4; /* exponential growth */
|
249
249
|
if (size < 4 * namelen)
|
250
250
|
size = 4 * namelen; /* just in case ! */
|
251
|
-
pool = (xmlDictStringsPtr)
|
251
|
+
pool = (xmlDictStringsPtr) nl_xmlMalloc(sizeof(xmlDictStrings) + size);
|
252
252
|
if (pool == NULL)
|
253
253
|
return(NULL);
|
254
254
|
pool->size = size;
|
@@ -316,7 +316,7 @@ xmlDictAddQString(xmlDictPtr dict, const xmlChar *prefix, unsigned int plen,
|
|
316
316
|
else size *= 4; /* exponential growth */
|
317
317
|
if (size < 4 * (namelen + plen + 1))
|
318
318
|
size = 4 * (namelen + plen + 1); /* just in case ! */
|
319
|
-
pool = (xmlDictStringsPtr)
|
319
|
+
pool = (xmlDictStringsPtr) nl_xmlMalloc(sizeof(xmlDictStrings) + size);
|
320
320
|
if (pool == NULL)
|
321
321
|
return(NULL);
|
322
322
|
pool->size = size;
|
@@ -545,30 +545,30 @@ xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
|
|
545
545
|
}
|
546
546
|
|
547
547
|
/**
|
548
|
-
*
|
548
|
+
* nl_xmlDictCreate:
|
549
549
|
*
|
550
550
|
* Create a new dictionary
|
551
551
|
*
|
552
552
|
* Returns the newly created dictionary, or NULL if an error occurred.
|
553
553
|
*/
|
554
554
|
xmlDictPtr
|
555
|
-
|
555
|
+
nl_xmlDictCreate(void) {
|
556
556
|
xmlDictPtr dict;
|
557
557
|
|
558
|
-
|
558
|
+
nl_xmlInitParser();
|
559
559
|
|
560
560
|
#ifdef DICT_DEBUG_PATTERNS
|
561
561
|
fprintf(stderr, "C");
|
562
562
|
#endif
|
563
563
|
|
564
|
-
dict =
|
564
|
+
dict = nl_xmlMalloc(sizeof(xmlDict));
|
565
565
|
if (dict) {
|
566
566
|
dict->ref_counter = 1;
|
567
567
|
dict->limit = 0;
|
568
568
|
|
569
569
|
dict->size = MIN_DICT_SIZE;
|
570
570
|
dict->nbElems = 0;
|
571
|
-
dict->dict =
|
571
|
+
dict->dict = nl_xmlMalloc(MIN_DICT_SIZE * sizeof(xmlDictEntry));
|
572
572
|
dict->strings = NULL;
|
573
573
|
dict->subdict = NULL;
|
574
574
|
if (dict->dict) {
|
@@ -580,13 +580,13 @@ xmlDictCreate(void) {
|
|
580
580
|
#endif
|
581
581
|
return(dict);
|
582
582
|
}
|
583
|
-
|
583
|
+
nl_xmlFree(dict);
|
584
584
|
}
|
585
585
|
return(NULL);
|
586
586
|
}
|
587
587
|
|
588
588
|
/**
|
589
|
-
*
|
589
|
+
* nl_xmlDictCreateSub:
|
590
590
|
* @sub: an existing dictionary
|
591
591
|
*
|
592
592
|
* Create a new dictionary, inheriting strings from the read-only
|
@@ -597,8 +597,8 @@ xmlDictCreate(void) {
|
|
597
597
|
* Returns the newly created dictionary, or NULL if an error occurred.
|
598
598
|
*/
|
599
599
|
xmlDictPtr
|
600
|
-
|
601
|
-
xmlDictPtr dict =
|
600
|
+
nl_xmlDictCreateSub(xmlDictPtr sub) {
|
601
|
+
xmlDictPtr dict = nl_xmlDictCreate();
|
602
602
|
|
603
603
|
if ((dict != NULL) && (sub != NULL)) {
|
604
604
|
#ifdef DICT_DEBUG_PATTERNS
|
@@ -606,13 +606,13 @@ xmlDictCreateSub(xmlDictPtr sub) {
|
|
606
606
|
#endif
|
607
607
|
dict->seed = sub->seed;
|
608
608
|
dict->subdict = sub;
|
609
|
-
|
609
|
+
nl_xmlDictReference(dict->subdict);
|
610
610
|
}
|
611
611
|
return(dict);
|
612
612
|
}
|
613
613
|
|
614
614
|
/**
|
615
|
-
*
|
615
|
+
* nl_xmlDictReference:
|
616
616
|
* @dict: the dictionary
|
617
617
|
*
|
618
618
|
* Increment the reference counter of a dictionary
|
@@ -620,11 +620,11 @@ xmlDictCreateSub(xmlDictPtr sub) {
|
|
620
620
|
* Returns 0 in case of success and -1 in case of error
|
621
621
|
*/
|
622
622
|
int
|
623
|
-
|
623
|
+
nl_xmlDictReference(xmlDictPtr dict) {
|
624
624
|
if (dict == NULL) return -1;
|
625
|
-
|
625
|
+
nl_xmlMutexLock(&xmlDictMutex);
|
626
626
|
dict->ref_counter++;
|
627
|
-
|
627
|
+
nl_xmlMutexUnlock(&xmlDictMutex);
|
628
628
|
return(0);
|
629
629
|
}
|
630
630
|
|
@@ -667,7 +667,7 @@ xmlDictGrow(xmlDictPtr dict, size_t size) {
|
|
667
667
|
if (oldsize == MIN_DICT_SIZE)
|
668
668
|
keep_keys = 0;
|
669
669
|
|
670
|
-
dict->dict =
|
670
|
+
dict->dict = nl_xmlMalloc(size * sizeof(xmlDictEntry));
|
671
671
|
if (dict->dict == NULL) {
|
672
672
|
dict->dict = olddict;
|
673
673
|
return(-1);
|
@@ -698,7 +698,7 @@ xmlDictGrow(xmlDictPtr dict, size_t size) {
|
|
698
698
|
} else {
|
699
699
|
xmlDictEntryPtr entry;
|
700
700
|
|
701
|
-
entry =
|
701
|
+
entry = nl_xmlMalloc(sizeof(xmlDictEntry));
|
702
702
|
if (entry != NULL) {
|
703
703
|
entry->name = olddict[i].name;
|
704
704
|
entry->len = olddict[i].len;
|
@@ -738,7 +738,7 @@ xmlDictGrow(xmlDictPtr dict, size_t size) {
|
|
738
738
|
dict->dict[key].next = NULL;
|
739
739
|
dict->dict[key].valid = 1;
|
740
740
|
dict->dict[key].okey = okey;
|
741
|
-
|
741
|
+
nl_xmlFree(iter);
|
742
742
|
} else {
|
743
743
|
iter->next = dict->dict[key].next;
|
744
744
|
iter->okey = okey;
|
@@ -753,10 +753,10 @@ xmlDictGrow(xmlDictPtr dict, size_t size) {
|
|
753
753
|
}
|
754
754
|
}
|
755
755
|
|
756
|
-
|
756
|
+
nl_xmlFree(olddict);
|
757
757
|
|
758
758
|
#ifdef DEBUG_GROW
|
759
|
-
|
759
|
+
nl_xmlGenericError(nl_xmlGenericErrorContext,
|
760
760
|
"xmlDictGrow : from %lu to %lu, %u elems\n", oldsize, size, nbElem);
|
761
761
|
#endif
|
762
762
|
|
@@ -764,14 +764,14 @@ xmlDictGrow(xmlDictPtr dict, size_t size) {
|
|
764
764
|
}
|
765
765
|
|
766
766
|
/**
|
767
|
-
*
|
767
|
+
* nl_xmlDictFree:
|
768
768
|
* @dict: the dictionary
|
769
769
|
*
|
770
770
|
* Free the hash @dict and its contents. The userdata is
|
771
771
|
* deallocated with @f if provided.
|
772
772
|
*/
|
773
773
|
void
|
774
|
-
|
774
|
+
nl_xmlDictFree(xmlDictPtr dict) {
|
775
775
|
size_t i;
|
776
776
|
xmlDictEntryPtr iter;
|
777
777
|
xmlDictEntryPtr next;
|
@@ -782,17 +782,17 @@ xmlDictFree(xmlDictPtr dict) {
|
|
782
782
|
return;
|
783
783
|
|
784
784
|
/* decrement the counter, it may be shared by a parser and docs */
|
785
|
-
|
785
|
+
nl_xmlMutexLock(&xmlDictMutex);
|
786
786
|
dict->ref_counter--;
|
787
787
|
if (dict->ref_counter > 0) {
|
788
|
-
|
788
|
+
nl_xmlMutexUnlock(&xmlDictMutex);
|
789
789
|
return;
|
790
790
|
}
|
791
791
|
|
792
|
-
|
792
|
+
nl_xmlMutexUnlock(&xmlDictMutex);
|
793
793
|
|
794
794
|
if (dict->subdict != NULL) {
|
795
|
-
|
795
|
+
nl_xmlDictFree(dict->subdict);
|
796
796
|
}
|
797
797
|
|
798
798
|
if (dict->dict) {
|
@@ -804,25 +804,25 @@ xmlDictFree(xmlDictPtr dict) {
|
|
804
804
|
while (iter) {
|
805
805
|
next = iter->next;
|
806
806
|
if (!inside_dict)
|
807
|
-
|
807
|
+
nl_xmlFree(iter);
|
808
808
|
dict->nbElems--;
|
809
809
|
inside_dict = 0;
|
810
810
|
iter = next;
|
811
811
|
}
|
812
812
|
}
|
813
|
-
|
813
|
+
nl_xmlFree(dict->dict);
|
814
814
|
}
|
815
815
|
pool = dict->strings;
|
816
816
|
while (pool != NULL) {
|
817
817
|
nextp = pool->next;
|
818
|
-
|
818
|
+
nl_xmlFree(pool);
|
819
819
|
pool = nextp;
|
820
820
|
}
|
821
|
-
|
821
|
+
nl_xmlFree(dict);
|
822
822
|
}
|
823
823
|
|
824
824
|
/**
|
825
|
-
*
|
825
|
+
* nl_xmlDictLookup:
|
826
826
|
* @dict: the dictionary
|
827
827
|
* @name: the name of the userdata
|
828
828
|
* @len: the length of the name, if -1 it is recomputed
|
@@ -832,7 +832,7 @@ xmlDictFree(xmlDictPtr dict) {
|
|
832
832
|
* Returns the internal copy of the name or NULL in case of internal error
|
833
833
|
*/
|
834
834
|
const xmlChar *
|
835
|
-
|
835
|
+
nl_xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) {
|
836
836
|
unsigned long key, okey, nbi = 0;
|
837
837
|
xmlDictEntryPtr entry;
|
838
838
|
xmlDictEntryPtr insert;
|
@@ -868,7 +868,7 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) {
|
|
868
868
|
}
|
869
869
|
#else
|
870
870
|
if ((insert->okey == okey) && (insert->len == l) &&
|
871
|
-
(!
|
871
|
+
(!nl_xmlStrncmp(insert->name, name, l)))
|
872
872
|
return(insert->name);
|
873
873
|
#endif
|
874
874
|
nbi++;
|
@@ -880,7 +880,7 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) {
|
|
880
880
|
}
|
881
881
|
#else
|
882
882
|
if ((insert->okey == okey) && (insert->len == l) &&
|
883
|
-
(!
|
883
|
+
(!nl_xmlStrncmp(insert->name, name, l)))
|
884
884
|
return(insert->name);
|
885
885
|
#endif
|
886
886
|
}
|
@@ -910,7 +910,7 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) {
|
|
910
910
|
}
|
911
911
|
#else
|
912
912
|
if ((tmp->okey == skey) && (tmp->len == l) &&
|
913
|
-
(!
|
913
|
+
(!nl_xmlStrncmp(tmp->name, name, l)))
|
914
914
|
return(tmp->name);
|
915
915
|
#endif
|
916
916
|
nbi++;
|
@@ -922,7 +922,7 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) {
|
|
922
922
|
}
|
923
923
|
#else
|
924
924
|
if ((tmp->okey == skey) && (tmp->len == l) &&
|
925
|
-
(!
|
925
|
+
(!nl_xmlStrncmp(tmp->name, name, l)))
|
926
926
|
return(tmp->name);
|
927
927
|
#endif
|
928
928
|
}
|
@@ -935,7 +935,7 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) {
|
|
935
935
|
if (insert == NULL) {
|
936
936
|
entry = &(dict->dict[key]);
|
937
937
|
} else {
|
938
|
-
entry =
|
938
|
+
entry = nl_xmlMalloc(sizeof(xmlDictEntry));
|
939
939
|
if (entry == NULL)
|
940
940
|
return(NULL);
|
941
941
|
}
|
@@ -962,7 +962,7 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) {
|
|
962
962
|
}
|
963
963
|
|
964
964
|
/**
|
965
|
-
*
|
965
|
+
* nl_xmlDictExists:
|
966
966
|
* @dict: the dictionary
|
967
967
|
* @name: the name of the userdata
|
968
968
|
* @len: the length of the name, if -1 it is recomputed
|
@@ -972,7 +972,7 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) {
|
|
972
972
|
* Returns the internal copy of the name or NULL if not found.
|
973
973
|
*/
|
974
974
|
const xmlChar *
|
975
|
-
|
975
|
+
nl_xmlDictExists(xmlDictPtr dict, const xmlChar *name, int len) {
|
976
976
|
unsigned long key, okey;
|
977
977
|
xmlDictEntryPtr insert;
|
978
978
|
unsigned int l;
|
@@ -1005,7 +1005,7 @@ xmlDictExists(xmlDictPtr dict, const xmlChar *name, int len) {
|
|
1005
1005
|
}
|
1006
1006
|
#else
|
1007
1007
|
if ((insert->okey == okey) && (insert->len == l) &&
|
1008
|
-
(!
|
1008
|
+
(!nl_xmlStrncmp(insert->name, name, l)))
|
1009
1009
|
return(insert->name);
|
1010
1010
|
#endif
|
1011
1011
|
}
|
@@ -1016,7 +1016,7 @@ xmlDictExists(xmlDictPtr dict, const xmlChar *name, int len) {
|
|
1016
1016
|
}
|
1017
1017
|
#else
|
1018
1018
|
if ((insert->okey == okey) && (insert->len == l) &&
|
1019
|
-
(!
|
1019
|
+
(!nl_xmlStrncmp(insert->name, name, l)))
|
1020
1020
|
return(insert->name);
|
1021
1021
|
#endif
|
1022
1022
|
}
|
@@ -1046,7 +1046,7 @@ xmlDictExists(xmlDictPtr dict, const xmlChar *name, int len) {
|
|
1046
1046
|
}
|
1047
1047
|
#else
|
1048
1048
|
if ((tmp->okey == skey) && (tmp->len == l) &&
|
1049
|
-
(!
|
1049
|
+
(!nl_xmlStrncmp(tmp->name, name, l)))
|
1050
1050
|
return(tmp->name);
|
1051
1051
|
#endif
|
1052
1052
|
}
|
@@ -1057,7 +1057,7 @@ xmlDictExists(xmlDictPtr dict, const xmlChar *name, int len) {
|
|
1057
1057
|
}
|
1058
1058
|
#else
|
1059
1059
|
if ((tmp->okey == skey) && (tmp->len == l) &&
|
1060
|
-
(!
|
1060
|
+
(!nl_xmlStrncmp(tmp->name, name, l)))
|
1061
1061
|
return(tmp->name);
|
1062
1062
|
#endif
|
1063
1063
|
}
|
@@ -1068,7 +1068,7 @@ xmlDictExists(xmlDictPtr dict, const xmlChar *name, int len) {
|
|
1068
1068
|
}
|
1069
1069
|
|
1070
1070
|
/**
|
1071
|
-
*
|
1071
|
+
* nl_xmlDictQLookup:
|
1072
1072
|
* @dict: the dictionary
|
1073
1073
|
* @prefix: the prefix
|
1074
1074
|
* @name: the name
|
@@ -1078,7 +1078,7 @@ xmlDictExists(xmlDictPtr dict, const xmlChar *name, int len) {
|
|
1078
1078
|
* Returns the internal copy of the QName or NULL in case of internal error
|
1079
1079
|
*/
|
1080
1080
|
const xmlChar *
|
1081
|
-
|
1081
|
+
nl_xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name) {
|
1082
1082
|
unsigned long okey, key, nbi = 0;
|
1083
1083
|
xmlDictEntryPtr entry;
|
1084
1084
|
xmlDictEntryPtr insert;
|
@@ -1088,7 +1088,7 @@ xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name) {
|
|
1088
1088
|
if ((dict == NULL) || (name == NULL))
|
1089
1089
|
return(NULL);
|
1090
1090
|
if (prefix == NULL)
|
1091
|
-
return(
|
1091
|
+
return(nl_xmlDictLookup(dict, name, -1));
|
1092
1092
|
|
1093
1093
|
l = len = strlen((const char *) name);
|
1094
1094
|
plen = strlen((const char *) prefix);
|
@@ -1105,12 +1105,12 @@ xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name) {
|
|
1105
1105
|
for (insert = &(dict->dict[key]); insert->next != NULL;
|
1106
1106
|
insert = insert->next) {
|
1107
1107
|
if ((insert->okey == okey) && (insert->len == len) &&
|
1108
|
-
(
|
1108
|
+
(nl_xmlStrQEqual(prefix, name, insert->name)))
|
1109
1109
|
return(insert->name);
|
1110
1110
|
nbi++;
|
1111
1111
|
}
|
1112
1112
|
if ((insert->okey == okey) && (insert->len == len) &&
|
1113
|
-
(
|
1113
|
+
(nl_xmlStrQEqual(prefix, name, insert->name)))
|
1114
1114
|
return(insert->name);
|
1115
1115
|
}
|
1116
1116
|
|
@@ -1132,12 +1132,12 @@ xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name) {
|
|
1132
1132
|
for (tmp = &(dict->subdict->dict[key]); tmp->next != NULL;
|
1133
1133
|
tmp = tmp->next) {
|
1134
1134
|
if ((tmp->okey == skey) && (tmp->len == len) &&
|
1135
|
-
(
|
1135
|
+
(nl_xmlStrQEqual(prefix, name, tmp->name)))
|
1136
1136
|
return(tmp->name);
|
1137
1137
|
nbi++;
|
1138
1138
|
}
|
1139
1139
|
if ((tmp->okey == skey) && (tmp->len == len) &&
|
1140
|
-
(
|
1140
|
+
(nl_xmlStrQEqual(prefix, name, tmp->name)))
|
1141
1141
|
return(tmp->name);
|
1142
1142
|
}
|
1143
1143
|
key = okey % dict->size;
|
@@ -1149,7 +1149,7 @@ xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name) {
|
|
1149
1149
|
if (insert == NULL) {
|
1150
1150
|
entry = &(dict->dict[key]);
|
1151
1151
|
} else {
|
1152
|
-
entry =
|
1152
|
+
entry = nl_xmlMalloc(sizeof(xmlDictEntry));
|
1153
1153
|
if (entry == NULL)
|
1154
1154
|
return(NULL);
|
1155
1155
|
}
|
@@ -1173,7 +1173,7 @@ xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name) {
|
|
1173
1173
|
}
|
1174
1174
|
|
1175
1175
|
/**
|
1176
|
-
*
|
1176
|
+
* nl_xmlDictOwns:
|
1177
1177
|
* @dict: the dictionary
|
1178
1178
|
* @str: the string
|
1179
1179
|
*
|
@@ -1183,7 +1183,7 @@ xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name) {
|
|
1183
1183
|
* -1 in case of error
|
1184
1184
|
*/
|
1185
1185
|
int
|
1186
|
-
|
1186
|
+
nl_xmlDictOwns(xmlDictPtr dict, const xmlChar *str) {
|
1187
1187
|
xmlDictStringsPtr pool;
|
1188
1188
|
|
1189
1189
|
if ((dict == NULL) || (str == NULL))
|
@@ -1195,12 +1195,12 @@ xmlDictOwns(xmlDictPtr dict, const xmlChar *str) {
|
|
1195
1195
|
pool = pool->next;
|
1196
1196
|
}
|
1197
1197
|
if (dict->subdict)
|
1198
|
-
return(
|
1198
|
+
return(nl_xmlDictOwns(dict->subdict, str));
|
1199
1199
|
return(0);
|
1200
1200
|
}
|
1201
1201
|
|
1202
1202
|
/**
|
1203
|
-
*
|
1203
|
+
* nl_xmlDictSize:
|
1204
1204
|
* @dict: the dictionary
|
1205
1205
|
*
|
1206
1206
|
* Query the number of elements installed in the hash @dict.
|
@@ -1209,7 +1209,7 @@ xmlDictOwns(xmlDictPtr dict, const xmlChar *str) {
|
|
1209
1209
|
* -1 in case of error
|
1210
1210
|
*/
|
1211
1211
|
int
|
1212
|
-
|
1212
|
+
nl_xmlDictSize(xmlDictPtr dict) {
|
1213
1213
|
if (dict == NULL)
|
1214
1214
|
return(-1);
|
1215
1215
|
if (dict->subdict)
|
@@ -1218,7 +1218,7 @@ xmlDictSize(xmlDictPtr dict) {
|
|
1218
1218
|
}
|
1219
1219
|
|
1220
1220
|
/**
|
1221
|
-
*
|
1221
|
+
* nl_xmlDictSetLimit:
|
1222
1222
|
* @dict: the dictionary
|
1223
1223
|
* @limit: the limit in bytes
|
1224
1224
|
*
|
@@ -1228,7 +1228,7 @@ xmlDictSize(xmlDictPtr dict) {
|
|
1228
1228
|
* Returns the previous limit of the dictionary or 0
|
1229
1229
|
*/
|
1230
1230
|
size_t
|
1231
|
-
|
1231
|
+
nl_xmlDictSetLimit(xmlDictPtr dict, size_t limit) {
|
1232
1232
|
size_t ret;
|
1233
1233
|
|
1234
1234
|
if (dict == NULL)
|
@@ -1239,7 +1239,7 @@ xmlDictSetLimit(xmlDictPtr dict, size_t limit) {
|
|
1239
1239
|
}
|
1240
1240
|
|
1241
1241
|
/**
|
1242
|
-
*
|
1242
|
+
* nl_xmlDictGetUsage:
|
1243
1243
|
* @dict: the dictionary
|
1244
1244
|
*
|
1245
1245
|
* Get how much memory is used by a dictionary for strings
|
@@ -1248,7 +1248,7 @@ xmlDictSetLimit(xmlDictPtr dict, size_t limit) {
|
|
1248
1248
|
* Returns the amount of strings allocated
|
1249
1249
|
*/
|
1250
1250
|
size_t
|
1251
|
-
|
1251
|
+
nl_xmlDictGetUsage(xmlDictPtr dict) {
|
1252
1252
|
xmlDictStringsPtr pool;
|
1253
1253
|
size_t limit = 0;
|
1254
1254
|
|
@@ -87,7 +87,7 @@ static int xmlLittleEndian = 1;
|
|
87
87
|
static void
|
88
88
|
xmlEncodingErrMemory(const char *extra)
|
89
89
|
{
|
90
|
-
|
90
|
+
__nl_xmlSimpleError(XML_FROM_I18N, XML_ERR_NO_MEMORY, NULL, NULL, extra);
|
91
91
|
}
|
92
92
|
|
93
93
|
/**
|
@@ -100,7 +100,7 @@ xmlEncodingErrMemory(const char *extra)
|
|
100
100
|
static void LIBXML_ATTR_FORMAT(2,0)
|
101
101
|
xmlEncodingErr(xmlParserErrors error, const char *msg, const char *val)
|
102
102
|
{
|
103
|
-
|
103
|
+
__nl_xmlRaiseError(NULL, NULL, NULL, NULL, NULL,
|
104
104
|
XML_FROM_I18N, error, XML_ERR_FATAL,
|
105
105
|
NULL, 0, val, NULL, NULL, 0, 0, msg, val);
|
106
106
|
}
|