/* Returns CR_OK, upon successful completion, an error code otherwise.  */
enum CRStatus cr_sel_eng_register_pseudo_class_sel_handler(CRSelEng *a_this, guchar *a_name, enum CRPseudoType a_type, CRPseudoClassSelectorHandler a_handler)
/* Returns CR_OK, upon successful completion, an error code otherwise.  */
enum CRStatus cr_sel_eng_register_pseudo_class_sel_handler(CRSelEng *a_this, guchar *a_name, enum CRPseudoType a_type, CRPseudoClassSelectorHandler a_handler)
{
        struct CRPseudoClassSelHandlerEntry *handler_entry = NULL;
        GList *list = NULL;
        g_return_val_if_fail (a_this && PRIVATE (a_this)
                              && a_handler && a_name, CR_BAD_PARAM_ERROR);
        handler_entry = g_try_malloc
                (sizeof (struct CRPseudoClassSelHandlerEntry));
        if (!handler_entry) {
                return CR_OUT_OF_MEMORY_ERROR;
        }
        memset (handler_entry, 0,
                sizeof (struct CRPseudoClassSelHandlerEntry));
        handler_entry->name = g_strdup (a_name);
        handler_entry->type = a_type;
        handler_entry->handler = a_handler;
        list = g_list_append (PRIVATE (a_this)->pcs_handlers, handler_entry);
        if (!list) {
                return CR_OUT_OF_MEMORY_ERROR;
        }
        PRIVATE (a_this)->pcs_handlers = list;
        return CR_OK;
}