Logo Search packages:      
Sourcecode: inkscape version File versions

CRStatement* cr_statement_new_at_charset_rule ( CRStyleSheet a_sheet,
CRString *  a_charset 
)

Creates a new instance of CRStatement of type CRAtCharsetRule.

Parameters:
a_charset the string representing the charset. Note that the newly built instance of CRStatement becomes the owner of a_charset. The caller must not free a_charset !!!.
Returns:
the newly built instance of CRStatement or NULL if an error arises.

Definition at line 1524 of file cr-statement.c.

References AT_CHARSET_RULE_STMT, cr_statement_set_parent_sheet(), and cr_utils_trace_info.

Referenced by cr_statement_at_charset_rule_parse_from_buf().

{
        g_return_val_if_fail (a_charset, NULL);

        CRStatement *result = (CRStatement *)g_try_malloc (sizeof (CRStatement));

        if (!result) {
                cr_utils_trace_info ("Out of memory");
                return NULL;
        }

        memset (result, 0, sizeof (CRStatement));
        result->type = AT_CHARSET_RULE_STMT;

        result->kind.charset_rule = (CRAtCharsetRule *)g_try_malloc (sizeof (CRAtCharsetRule));

        if (!result->kind.charset_rule) {
                cr_utils_trace_info ("Out of memory");
                g_free (result);
                return NULL;
        }
        memset (result->kind.charset_rule, 0, sizeof (CRAtCharsetRule));
        result->kind.charset_rule->charset = a_charset;
        cr_statement_set_parent_sheet (result, a_sheet);

        return result;
}


Generated by  Doxygen 1.6.0   Back to index