diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2007-05-08 17:26:22 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2007-05-08 22:00:46 +0100 |
commit | ede76a97ea5b68c3bd042dc6a93ecb1aa7c9761c (patch) | |
tree | 123be40b5b3b38c1a7bd61e12c6e25116edf136b /src/cairo-font-options.c | |
parent | c441938569ed78123a57662a70ef5a74dcf73851 (diff) | |
download | cairo-ede76a97ea5b68c3bd042dc6a93ecb1aa7c9761c.tar.gz |
[cairo-font-options] Check for the nil-object.
The design is for the user to create a cairo_font_options_t object with
cairo_font_options_create() and then is free to use it with any Cairo
operation. This requires us to check when we may be about to overwrite
the read-only nil object.
Diffstat (limited to 'src/cairo-font-options.c')
-rw-r--r-- | src/cairo-font-options.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cairo-font-options.c b/src/cairo-font-options.c index ccdffa992..33b021da1 100644 --- a/src/cairo-font-options.c +++ b/src/cairo-font-options.c @@ -113,8 +113,12 @@ slim_hidden_def (cairo_font_options_create); cairo_font_options_t * cairo_font_options_copy (const cairo_font_options_t *original) { - cairo_font_options_t *options = malloc (sizeof (cairo_font_options_t)); + cairo_font_options_t *options; + + if (original == &_cairo_font_options_nil) + return (cairo_font_options_t *)&_cairo_font_options_nil; + options = malloc (sizeof (cairo_font_options_t)); if (!options) return (cairo_font_options_t *)&_cairo_font_options_nil; @@ -157,6 +161,7 @@ cairo_font_options_status (cairo_font_options_t *options) else return CAIRO_STATUS_SUCCESS; } +slim_hidden_def (cairo_font_options_status); /** * cairo_font_options_merge: |