Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(470)

Side by Side Diff: third_party/libxml/src/timsort.h

Issue 1202303002: Revert of Fix incorrect libxml fprintf, erroring on clang win x64 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/libxml/README.chromium ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * taken from https://github.com/swenson/sort 2 * taken from https://github.com/swenson/sort
3 * Kept as is for the moment to be able to apply upstream patches for that 3 * Kept as is for the moment to be able to apply upstream patches for that
4 * code, currently used only to speed up XPath node sorting, see xpath.c 4 * code, currently used only to speed up XPath node sorting, see xpath.c
5 */ 5 */
6 6
7 /* 7 /*
8 * All code in this header, unless otherwise specified, is hereby licensed under the MIT Public License: 8 * All code in this header, unless otherwise specified, is hereby licensed under the MIT Public License:
9 9
10 Copyright (c) 2010 Christopher Swenson 10 Copyright (c) 2010 Christopher Swenson
11 11
12 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in th e Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subj ect to the following conditions: 12 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in th e Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subj ect to the following conditions:
13 13
14 The above copyright notice and this permission notice shall be included in all c opies or substantial portions of the Software. 14 The above copyright notice and this permission notice shall be included in all c opies or substantial portions of the Software.
15 15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI ED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYR IGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WIT H THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI ED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYR IGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WIT H THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17 */ 17 */
18 18
19 #include <stdlib.h> 19 #include <stdlib.h>
20 #include <stdio.h> 20 #include <stdio.h>
21 #include <string.h> 21 #include <string.h>
22 #ifdef HAVE_STDINT_H 22 #ifdef HAVE_STDINT_H
23 #include <stdint.h> 23 #include <stdint.h>
24 #else 24 #else
25 #ifdef HAVE_INTTYPES_H 25 #ifdef HAVE_INTTYPES_H
26 #include <inttypes.h> 26 #include <inttypes.h>
27 #elif defined(WIN32) 27 #elif defined(WIN32)
28 typedef __int64 int64_t; 28 typedef __int64 int64_t;
29 typedef unsigned __int64 uint64_t; 29 typedef unsigned __int64 uint64_t;
30 #if !defined(PRIuS)
31 #define PRIuS "Iu"
32 #endif
33 #endif 30 #endif
34 #endif 31 #endif
35 32
36 #ifndef MK_UINT64 33 #ifndef MK_UINT64
37 #if defined(WIN32) && defined(_MSC_VER) && _MSC_VER < 1300 34 #if defined(WIN32) && defined(_MSC_VER) && _MSC_VER < 1300
38 #define MK_UINT64(x) ((uint64_t)(x)) 35 #define MK_UINT64(x) ((uint64_t)(x))
39 #else 36 #else
40 #define MK_UINT64(x) x##ULL 37 #define MK_UINT64(x) x##ULL
41 #endif 38 #endif
42 #endif 39 #endif
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 } TEMP_STORAGE_T; 316 } TEMP_STORAGE_T;
320 317
321 318
322 static void TIM_SORT_RESIZE(TEMP_STORAGE_T *store, const size_t new_size) 319 static void TIM_SORT_RESIZE(TEMP_STORAGE_T *store, const size_t new_size)
323 { 320 {
324 if (store->alloc < new_size) 321 if (store->alloc < new_size)
325 { 322 {
326 SORT_TYPE *tempstore = (SORT_TYPE *)realloc(store->storage, new_size * sizeo f(SORT_TYPE)); 323 SORT_TYPE *tempstore = (SORT_TYPE *)realloc(store->storage, new_size * sizeo f(SORT_TYPE));
327 if (tempstore == NULL) 324 if (tempstore == NULL)
328 { 325 {
329 fprintf(stderr, "Error allocating temporary storage for tim sort: need %" PRIuS " bytes", sizeof(SORT_TYPE) * new_size); 326 fprintf(stderr, "Error allocating temporary storage for tim sort: need %lu bytes", sizeof(SORT_TYPE) * new_size);
330 exit(1); 327 exit(1);
331 } 328 }
332 store->storage = tempstore; 329 store->storage = tempstore;
333 store->alloc = new_size; 330 store->alloc = new_size;
334 } 331 }
335 } 332 }
336 333
337 static void TIM_SORT_MERGE(SORT_TYPE *dst, const TIM_SORT_RUN_T *stack, const in t stack_curr, TEMP_STORAGE_T *store) 334 static void TIM_SORT_MERGE(SORT_TYPE *dst, const TIM_SORT_RUN_T *stack, const in t stack_curr, TEMP_STORAGE_T *store)
338 { 335 {
339 const int64_t A = stack[stack_curr - 2].length; 336 const int64_t A = stack[stack_curr - 2].length;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 #undef BINARY_INSERTION_FIND 505 #undef BINARY_INSERTION_FIND
509 #undef BINARY_INSERTION_SORT_START 506 #undef BINARY_INSERTION_SORT_START
510 #undef BINARY_INSERTION_SORT 507 #undef BINARY_INSERTION_SORT
511 #undef REVERSE_ELEMENTS 508 #undef REVERSE_ELEMENTS
512 #undef COUNT_RUN 509 #undef COUNT_RUN
513 #undef TIM_SORT 510 #undef TIM_SORT
514 #undef TIM_SORT_RESIZE 511 #undef TIM_SORT_RESIZE
515 #undef TIM_SORT_COLLAPSE 512 #undef TIM_SORT_COLLAPSE
516 #undef TIM_SORT_RUN_T 513 #undef TIM_SORT_RUN_T
517 #undef TEMP_STORAGE_T 514 #undef TEMP_STORAGE_T
OLDNEW
« no previous file with comments | « third_party/libxml/README.chromium ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698