aboutsummaryrefslogtreecommitdiffstats
path: root/src/xml.c
diff options
context:
space:
mode:
authorPaul Eggert2015-01-13 21:19:40 -0800
committerPaul Eggert2015-01-13 21:20:31 -0800
commit3ef29501b029567156440d257c758b99099213fe (patch)
tree32b48cd3c2b4d2e704c23e1e1690ed598b19fb31 /src/xml.c
parent785adfcc8dee02ac544f80e4f7f8d3d5b2965981 (diff)
downloademacs-3ef29501b029567156440d257c758b99099213fe.tar.gz
emacs-3ef29501b029567156440d257c758b99099213fe.zip
Use bool for boolean in xmenu.c, xml.c
* xmenu.c (x_menu_set_in_use, popup_get_selection) (Fx_menu_bar_open_internal, popup_widget_loop) (x_activate_menubar, xg_crazy_callback_abort) (update_frame_menubar, set_frame_menubar) (initialize_frame_menubar, free_frame_menubar) (create_and_show_popup_menu, x_menu_show) (create_and_show_dialog, x_dialog_show): * xml.c (libxml2_loaded_p, init_libxml2_functions, parse_region) (Flibxml_parse_html_region, Flibxml_parse_xml_region): * xrdb.c (main) [TESTRM]: * xsettings.c (init_gsettings): * xterm.c (XFillRectangle, xg_scroll_callback) (xg_end_scroll_callback): * xterm.h (x_menu_set_in_use) [USE_GTK || USE_MOTIF]: Use bool for boolean. * xmenu.c (TRUE): Remove; no longer used. (show_help_event): Remove long-unused code. (set_frame_menubar): Remove "#if 1" and corresponding "#endif" lines.
Diffstat (limited to 'src/xml.c')
-rw-r--r--src/xml.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/xml.c b/src/xml.c
index 3e64788f822..e32417724ce 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -43,14 +43,12 @@ DEF_DLL_FN (void, xmlFreeDoc, (xmlDocPtr));
43DEF_DLL_FN (void, xmlCleanupParser, (void)); 43DEF_DLL_FN (void, xmlCleanupParser, (void));
44DEF_DLL_FN (void, xmlCheckVersion, (int)); 44DEF_DLL_FN (void, xmlCheckVersion, (int));
45 45
46static int 46static bool
47libxml2_loaded_p (void) 47libxml2_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
84static int 82static bool
85libxml2_loaded_p (void) 83libxml2_loaded_p (void)
86{ 84{
87 return 1; 85 return true;
88} 86}
89 87
90#endif /* !WINDOWSNT */ 88#endif /* !WINDOWSNT */
91 89
92static int 90static bool
93init_libxml2_functions (void) 91init_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
179static Lisp_Object 177static Lisp_Object
180parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, Lisp_Object discard_comments, int htmlp) 178parse_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