nokolexbor 0.2.4 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -22,7 +22,7 @@
|
|
22
22
|
* allowed.
|
23
23
|
*
|
24
24
|
*/
|
25
|
-
const unsigned char
|
25
|
+
const unsigned char nl_xmlIsPubidChar_tab[256] = {
|
26
26
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
|
27
27
|
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
28
28
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01,
|
@@ -96,13 +96,13 @@ static const xmlChSRange xmlIsBaseChar_srng[] = { {0x100, 0x131},
|
|
96
96
|
{0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc},
|
97
97
|
{0x2126, 0x2126}, {0x212a, 0x212b}, {0x212e, 0x212e}, {0x2180, 0x2182},
|
98
98
|
{0x3041, 0x3094}, {0x30a1, 0x30fa}, {0x3105, 0x312c}, {0xac00, 0xd7a3}};
|
99
|
-
const xmlChRangeGroup
|
99
|
+
const xmlChRangeGroup nl_xmlIsBaseCharGroup =
|
100
100
|
{197, 0, xmlIsBaseChar_srng, (xmlChLRangePtr)0};
|
101
101
|
|
102
102
|
static const xmlChSRange xmlIsChar_srng[] = { {0x100, 0xd7ff},
|
103
103
|
{0xe000, 0xfffd}};
|
104
104
|
static const xmlChLRange xmlIsChar_lrng[] = { {0x10000, 0x10ffff}};
|
105
|
-
const xmlChRangeGroup
|
105
|
+
const xmlChRangeGroup nl_xmlIsCharGroup =
|
106
106
|
{2, 1, xmlIsChar_srng, xmlIsChar_lrng};
|
107
107
|
|
108
108
|
static const xmlChSRange xmlIsCombining_srng[] = { {0x300, 0x345},
|
@@ -130,7 +130,7 @@ static const xmlChSRange xmlIsCombining_srng[] = { {0x300, 0x345},
|
|
130
130
|
{0xf90, 0xf95}, {0xf97, 0xf97}, {0xf99, 0xfad}, {0xfb1, 0xfb7},
|
131
131
|
{0xfb9, 0xfb9}, {0x20d0, 0x20dc}, {0x20e1, 0x20e1}, {0x302a, 0x302f},
|
132
132
|
{0x3099, 0x3099}, {0x309a, 0x309a}};
|
133
|
-
const xmlChRangeGroup
|
133
|
+
const xmlChRangeGroup nl_xmlIsCombiningGroup =
|
134
134
|
{95, 0, xmlIsCombining_srng, (xmlChLRangePtr)0};
|
135
135
|
|
136
136
|
static const xmlChSRange xmlIsDigit_srng[] = { {0x660, 0x669},
|
@@ -138,24 +138,24 @@ static const xmlChSRange xmlIsDigit_srng[] = { {0x660, 0x669},
|
|
138
138
|
{0xae6, 0xaef}, {0xb66, 0xb6f}, {0xbe7, 0xbef}, {0xc66, 0xc6f},
|
139
139
|
{0xce6, 0xcef}, {0xd66, 0xd6f}, {0xe50, 0xe59}, {0xed0, 0xed9},
|
140
140
|
{0xf20, 0xf29}};
|
141
|
-
const xmlChRangeGroup
|
141
|
+
const xmlChRangeGroup nl_xmlIsDigitGroup =
|
142
142
|
{14, 0, xmlIsDigit_srng, (xmlChLRangePtr)0};
|
143
143
|
|
144
144
|
static const xmlChSRange xmlIsExtender_srng[] = { {0x2d0, 0x2d0},
|
145
145
|
{0x2d1, 0x2d1}, {0x387, 0x387}, {0x640, 0x640}, {0xe46, 0xe46},
|
146
146
|
{0xec6, 0xec6}, {0x3005, 0x3005}, {0x3031, 0x3035}, {0x309d, 0x309e},
|
147
147
|
{0x30fc, 0x30fe}};
|
148
|
-
const xmlChRangeGroup
|
148
|
+
const xmlChRangeGroup nl_xmlIsExtenderGroup =
|
149
149
|
{10, 0, xmlIsExtender_srng, (xmlChLRangePtr)0};
|
150
150
|
|
151
151
|
static const xmlChSRange xmlIsIdeographic_srng[] = { {0x3007, 0x3007},
|
152
152
|
{0x3021, 0x3029}, {0x4e00, 0x9fa5}};
|
153
|
-
const xmlChRangeGroup
|
153
|
+
const xmlChRangeGroup nl_xmlIsIdeographicGroup =
|
154
154
|
{3, 0, xmlIsIdeographic_srng, (xmlChLRangePtr)0};
|
155
155
|
|
156
156
|
|
157
157
|
/**
|
158
|
-
*
|
158
|
+
* nl_xmlCharInRange:
|
159
159
|
* @val: character to be validated
|
160
160
|
* @rptr: pointer to range to be used to validate
|
161
161
|
*
|
@@ -165,7 +165,7 @@ const xmlChRangeGroup xmlIsIdeographicGroup =
|
|
165
165
|
* Returns: true if character valid, false otherwise
|
166
166
|
*/
|
167
167
|
int
|
168
|
-
|
168
|
+
nl_xmlCharInRange (unsigned int val, const xmlChRangeGroup *rptr) {
|
169
169
|
int low, high, mid;
|
170
170
|
const xmlChSRange *sptr;
|
171
171
|
const xmlChLRange *lptr;
|
@@ -214,7 +214,7 @@ xmlCharInRange (unsigned int val, const xmlChRangeGroup *rptr) {
|
|
214
214
|
|
215
215
|
|
216
216
|
/**
|
217
|
-
*
|
217
|
+
* nl_xmlIsBaseChar:
|
218
218
|
* @ch: character to validate
|
219
219
|
*
|
220
220
|
* This function is DEPRECATED.
|
@@ -223,13 +223,13 @@ xmlCharInRange (unsigned int val, const xmlChRangeGroup *rptr) {
|
|
223
223
|
* Returns true if argument valid, false otherwise
|
224
224
|
*/
|
225
225
|
int
|
226
|
-
|
226
|
+
nl_xmlIsBaseChar(unsigned int ch) {
|
227
227
|
return(xmlIsBaseCharQ(ch));
|
228
228
|
}
|
229
229
|
|
230
230
|
|
231
231
|
/**
|
232
|
-
*
|
232
|
+
* nl_xmlIsBlank:
|
233
233
|
* @ch: character to validate
|
234
234
|
*
|
235
235
|
* This function is DEPRECATED.
|
@@ -238,13 +238,13 @@ xmlIsBaseChar(unsigned int ch) {
|
|
238
238
|
* Returns true if argument valid, false otherwise
|
239
239
|
*/
|
240
240
|
int
|
241
|
-
|
241
|
+
nl_xmlIsBlank(unsigned int ch) {
|
242
242
|
return(xmlIsBlankQ(ch));
|
243
243
|
}
|
244
244
|
|
245
245
|
|
246
246
|
/**
|
247
|
-
*
|
247
|
+
* nl_xmlIsChar:
|
248
248
|
* @ch: character to validate
|
249
249
|
*
|
250
250
|
* This function is DEPRECATED.
|
@@ -253,13 +253,13 @@ xmlIsBlank(unsigned int ch) {
|
|
253
253
|
* Returns true if argument valid, false otherwise
|
254
254
|
*/
|
255
255
|
int
|
256
|
-
|
256
|
+
nl_xmlIsChar(unsigned int ch) {
|
257
257
|
return(xmlIsCharQ(ch));
|
258
258
|
}
|
259
259
|
|
260
260
|
|
261
261
|
/**
|
262
|
-
*
|
262
|
+
* nl_xmlIsCombining:
|
263
263
|
* @ch: character to validate
|
264
264
|
*
|
265
265
|
* This function is DEPRECATED.
|
@@ -268,13 +268,13 @@ xmlIsChar(unsigned int ch) {
|
|
268
268
|
* Returns true if argument valid, false otherwise
|
269
269
|
*/
|
270
270
|
int
|
271
|
-
|
271
|
+
nl_xmlIsCombining(unsigned int ch) {
|
272
272
|
return(xmlIsCombiningQ(ch));
|
273
273
|
}
|
274
274
|
|
275
275
|
|
276
276
|
/**
|
277
|
-
*
|
277
|
+
* nl_xmlIsDigit:
|
278
278
|
* @ch: character to validate
|
279
279
|
*
|
280
280
|
* This function is DEPRECATED.
|
@@ -283,13 +283,13 @@ xmlIsCombining(unsigned int ch) {
|
|
283
283
|
* Returns true if argument valid, false otherwise
|
284
284
|
*/
|
285
285
|
int
|
286
|
-
|
286
|
+
nl_xmlIsDigit(unsigned int ch) {
|
287
287
|
return(xmlIsDigitQ(ch));
|
288
288
|
}
|
289
289
|
|
290
290
|
|
291
291
|
/**
|
292
|
-
*
|
292
|
+
* nl_xmlIsExtender:
|
293
293
|
* @ch: character to validate
|
294
294
|
*
|
295
295
|
* This function is DEPRECATED.
|
@@ -298,13 +298,13 @@ xmlIsDigit(unsigned int ch) {
|
|
298
298
|
* Returns true if argument valid, false otherwise
|
299
299
|
*/
|
300
300
|
int
|
301
|
-
|
301
|
+
nl_xmlIsExtender(unsigned int ch) {
|
302
302
|
return(xmlIsExtenderQ(ch));
|
303
303
|
}
|
304
304
|
|
305
305
|
|
306
306
|
/**
|
307
|
-
*
|
307
|
+
* nl_xmlIsIdeographic:
|
308
308
|
* @ch: character to validate
|
309
309
|
*
|
310
310
|
* This function is DEPRECATED.
|
@@ -313,13 +313,13 @@ xmlIsExtender(unsigned int ch) {
|
|
313
313
|
* Returns true if argument valid, false otherwise
|
314
314
|
*/
|
315
315
|
int
|
316
|
-
|
316
|
+
nl_xmlIsIdeographic(unsigned int ch) {
|
317
317
|
return(xmlIsIdeographicQ(ch));
|
318
318
|
}
|
319
319
|
|
320
320
|
|
321
321
|
/**
|
322
|
-
*
|
322
|
+
* nl_xmlIsPubidChar:
|
323
323
|
* @ch: character to validate
|
324
324
|
*
|
325
325
|
* This function is DEPRECATED.
|
@@ -328,7 +328,7 @@ xmlIsIdeographic(unsigned int ch) {
|
|
328
328
|
* Returns true if argument valid, false otherwise
|
329
329
|
*/
|
330
330
|
int
|
331
|
-
|
331
|
+
nl_xmlIsPubidChar(unsigned int ch) {
|
332
332
|
return(xmlIsPubidCharQ(ch));
|
333
333
|
}
|
334
334
|
|
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
|
|