Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/gumbo-parser/src/util.h @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 // Copyright 2010 Google Inc. All Rights Reserved. | |
| 2 // | |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 // you may not use this file except in compliance with the License. | |
| 5 // You may obtain a copy of the License at | |
| 6 // | |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 // | |
| 9 // Unless required by applicable law or agreed to in writing, software | |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 // See the License for the specific language governing permissions and | |
| 13 // limitations under the License. | |
| 14 // | |
| 15 // Author: jdtang@google.com (Jonathan Tang) | |
| 16 // | |
| 17 // This contains some utility functions that didn't fit into any of the other | |
| 18 // headers. | |
| 19 | |
| 20 #ifndef GUMBO_UTIL_H_ | |
| 21 #define GUMBO_UTIL_H_ | |
| 22 #ifdef _MSC_VER | |
| 23 #ifndef _CRT_SECURE_NO_WARNINGS | |
| 24 #define _CRT_SECURE_NO_WARNINGS | |
| 25 #endif | |
| 26 #endif | |
| 27 #include <stdbool.h> | |
| 28 #include <stddef.h> | |
| 29 | |
| 30 #ifdef __cplusplus | |
| 31 extern "C" { | |
| 32 #endif | |
| 33 | |
| 34 // Forward declaration since it's passed into some of the functions in this | |
| 35 // header. | |
| 36 struct GumboInternalParser; | |
| 37 | |
| 38 // Utility function for allocating & copying a null-terminated string into a | |
| 39 // freshly-allocated buffer. This is necessary for proper memory management; we | |
| 40 // have the convention that all const char* in parse tree structures are | |
| 41 // freshly-allocated, so if we didn't copy, we'd try to delete a literal string | |
| 42 // when the parse tree is destroyed. | |
| 43 char* gumbo_copy_stringz(struct GumboInternalParser* parser, const char* str); | |
| 44 | |
| 45 // Allocate a chunk of memory, using the allocator specified in the Parser's | |
| 46 // config options. | |
| 47 void* gumbo_parser_allocate( | |
| 48 struct GumboInternalParser* parser, size_t num_bytes); | |
| 49 | |
| 50 // Deallocate a chunk of memory, using the deallocator specified in the Parser's | |
| 51 // config options. | |
| 52 void gumbo_parser_deallocate(struct GumboInternalParser* parser, void* ptr); | |
| 53 | |
| 54 // Debug wrapper for printf, to make it easier to turn off debugging info when | |
| 55 // required. | |
| 56 void gumbo_debug(const char* format, ...); | |
| 57 | |
| 58 #ifdef __cplusplus | |
| 59 } | |
| 60 #endif | |
| 61 | |
| 62 #endif // GUMBO_UTIL_H_ |
