Dominic Lachowicz wrote: > I just wanted to say thanks for your libcroco patches. I've committed > most of them to SVN.
What about #3 mentioned in http://mail.gnome.org/archives/libcroco-list/2006-November/msg00000.html ? I propose this patch (also untested): 2007-01-10 Bruno Haible <[EMAIL PROTECTED]> * cr-sel-eng.c (strqcmp): New macro. (lang_pseudo_class_handler, id_add_sel_matches_node): Use it instead of strncmp. *** cr-sel-eng.c 27 Nov 2006 12:53:29 -0000 1.2 --- cr-sel-eng.c 10 Jan 2007 18:01:31 -0000 *************** static xmlNode *get_prev_element_node (x *** 106,111 **** --- 106,115 ---- static xmlNode *get_next_parent_element_node (xmlNode * a_node); + /* Quick strcmp. Test only for == 0 or != 0, not < 0 or > 0. */ + #define strqcmp(str,lit,lit_len) \ + (strlen (str) != (lit_len) || memcmp (str, lit, lit_len)) + static gboolean lang_pseudo_class_handler (CRSelEng * a_this, CRAdditionalSel * a_sel, xmlNode * a_node) *************** lang_pseudo_class_handler (CRSelEng * a_ *** 121,127 **** && a_sel->content.pseudo->name->stryng && a_node, CR_BAD_PARAM_ERROR); ! if (strncmp (a_sel->content.pseudo->name->stryng->str, "lang", 4) || !a_sel->content.pseudo->type == FUNCTION_PSEUDO) { cr_utils_trace_info ("This handler is for :lang only"); --- 125,131 ---- && a_sel->content.pseudo->name->stryng && a_node, CR_BAD_PARAM_ERROR); ! if (strqcmp (a_sel->content.pseudo->name->stryng->str, "lang", 4) || !a_sel->content.pseudo->type == FUNCTION_PSEUDO) { cr_utils_trace_info ("This handler is for :lang only"); *************** lang_pseudo_class_handler (CRSelEng * a_ *** 135,141 **** for (; node; node = get_next_parent_element_node (node)) { val = xmlGetProp (node, "lang"); if (val ! && !strncmp (val, a_sel->content.pseudo->extra->stryng->str, a_sel->content.pseudo->extra->stryng->len)) { result = TRUE; --- 139,145 ---- for (; node; node = get_next_parent_element_node (node)) { val = xmlGetProp (node, "lang"); if (val ! && !strqcmp (val, a_sel->content.pseudo->extra->stryng->str, a_sel->content.pseudo->extra->stryng->len)) { result = TRUE; *************** id_add_sel_matches_node (CRAdditionalSel *** 273,279 **** if (xmlHasProp (a_node, "id")) { id = xmlGetProp (a_node, "id"); ! if (!strncmp (id, a_add_sel->content.id_name->stryng->str, a_add_sel->content.id_name->stryng->len)) { result = TRUE; } --- 277,283 ---- if (xmlHasProp (a_node, "id")) { id = xmlGetProp (a_node, "id"); ! if (!strqcmp (id, a_add_sel->content.id_name->stryng->str, a_add_sel->content.id_name->stryng->len)) { result = TRUE; } _______________________________________________ Libcroco-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/libcroco-list
