diff options
Diffstat (limited to 'src/xml.c')
| -rw-r--r-- | src/xml.c | 29 |
1 files changed, 14 insertions, 15 deletions
| @@ -43,14 +43,12 @@ DEF_DLL_FN (void, xmlFreeDoc, (xmlDocPtr)); | |||
| 43 | DEF_DLL_FN (void, xmlCleanupParser, (void)); | 43 | DEF_DLL_FN (void, xmlCleanupParser, (void)); |
| 44 | DEF_DLL_FN (void, xmlCheckVersion, (int)); | 44 | DEF_DLL_FN (void, xmlCheckVersion, (int)); |
| 45 | 45 | ||
| 46 | static int | 46 | static bool |
| 47 | libxml2_loaded_p (void) | 47 | libxml2_loaded_p (void) |
| 48 | { | 48 | { |
| 49 | Lisp_Object found = Fassq (Qlibxml2_dll, Vlibrary_cache); | 49 | Lisp_Object found = Fassq (Qlibxml2_dll, Vlibrary_cache); |
| 50 | 50 | ||
| 51 | if (CONSP (found)) | 51 | return CONSP (found) && EQ (XCDR (found), Qt); |
| 52 | return EQ (XCDR (found), Qt) ? 1 : 0; | ||
| 53 | return 0; | ||
| 54 | } | 52 | } |
| 55 | 53 | ||
| 56 | # undef htmlReadMemory | 54 | # undef htmlReadMemory |
| @@ -81,20 +79,20 @@ load_dll_functions (HMODULE library) | |||
| 81 | 79 | ||
| 82 | #else /* !WINDOWSNT */ | 80 | #else /* !WINDOWSNT */ |
| 83 | 81 | ||
| 84 | static int | 82 | static bool |
| 85 | libxml2_loaded_p (void) | 83 | libxml2_loaded_p (void) |
| 86 | { | 84 | { |
| 87 | return 1; | 85 | return true; |
| 88 | } | 86 | } |
| 89 | 87 | ||
| 90 | #endif /* !WINDOWSNT */ | 88 | #endif /* !WINDOWSNT */ |
| 91 | 89 | ||
| 92 | static int | 90 | static bool |
| 93 | init_libxml2_functions (void) | 91 | init_libxml2_functions (void) |
| 94 | { | 92 | { |
| 95 | #ifdef WINDOWSNT | 93 | #ifdef WINDOWSNT |
| 96 | if (libxml2_loaded_p ()) | 94 | if (libxml2_loaded_p ()) |
| 97 | return 1; | 95 | return true; |
| 98 | else | 96 | else |
| 99 | { | 97 | { |
| 100 | HMODULE library; | 98 | HMODULE library; |
| @@ -102,22 +100,22 @@ init_libxml2_functions (void) | |||
| 102 | if (!(library = w32_delayed_load (Qlibxml2_dll))) | 100 | if (!(library = w32_delayed_load (Qlibxml2_dll))) |
| 103 | { | 101 | { |
| 104 | message1 ("libxml2 library not found"); | 102 | message1 ("libxml2 library not found"); |
| 105 | return 0; | 103 | return false; |
| 106 | } | 104 | } |
| 107 | 105 | ||
| 108 | if (! load_dll_functions (library)) | 106 | if (! load_dll_functions (library)) |
| 109 | goto bad_library; | 107 | goto bad_library; |
| 110 | 108 | ||
| 111 | Vlibrary_cache = Fcons (Fcons (Qlibxml2_dll, Qt), Vlibrary_cache); | 109 | Vlibrary_cache = Fcons (Fcons (Qlibxml2_dll, Qt), Vlibrary_cache); |
| 112 | return 1; | 110 | return true; |
| 113 | } | 111 | } |
| 114 | 112 | ||
| 115 | bad_library: | 113 | bad_library: |
| 116 | Vlibrary_cache = Fcons (Fcons (Qlibxml2_dll, Qnil), Vlibrary_cache); | 114 | Vlibrary_cache = Fcons (Fcons (Qlibxml2_dll, Qnil), Vlibrary_cache); |
| 117 | 115 | ||
| 118 | return 0; | 116 | return false; |
| 119 | #else /* !WINDOWSNT */ | 117 | #else /* !WINDOWSNT */ |
| 120 | return 1; | 118 | return true; |
| 121 | #endif /* !WINDOWSNT */ | 119 | #endif /* !WINDOWSNT */ |
| 122 | } | 120 | } |
| 123 | 121 | ||
| @@ -177,7 +175,8 @@ make_dom (xmlNode *node) | |||
| 177 | } | 175 | } |
| 178 | 176 | ||
| 179 | static Lisp_Object | 177 | static Lisp_Object |
| 180 | parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, Lisp_Object discard_comments, int htmlp) | 178 | parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, |
| 179 | Lisp_Object discard_comments, bool htmlp) | ||
| 181 | { | 180 | { |
| 182 | xmlDoc *doc; | 181 | xmlDoc *doc; |
| 183 | Lisp_Object result = Qnil; | 182 | Lisp_Object result = Qnil; |
| @@ -263,7 +262,7 @@ If DISCARD-COMMENTS is non-nil, all HTML comments are discarded. */) | |||
| 263 | (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, Lisp_Object discard_comments) | 262 | (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, Lisp_Object discard_comments) |
| 264 | { | 263 | { |
| 265 | if (init_libxml2_functions ()) | 264 | if (init_libxml2_functions ()) |
| 266 | return parse_region (start, end, base_url, discard_comments, 1); | 265 | return parse_region (start, end, base_url, discard_comments, true); |
| 267 | return Qnil; | 266 | return Qnil; |
| 268 | } | 267 | } |
| 269 | 268 | ||
| @@ -276,7 +275,7 @@ If DISCARD-COMMENTS is non-nil, all HTML comments are discarded. */) | |||
| 276 | (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, Lisp_Object discard_comments) | 275 | (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, Lisp_Object discard_comments) |
| 277 | { | 276 | { |
| 278 | if (init_libxml2_functions ()) | 277 | if (init_libxml2_functions ()) |
| 279 | return parse_region (start, end, base_url, discard_comments, 0); | 278 | return parse_region (start, end, base_url, discard_comments, false); |
| 280 | return Qnil; | 279 | return Qnil; |
| 281 | } | 280 | } |
| 282 | 281 | ||