summaryrefslogtreecommitdiff
path: root/src/cairo-output-stream.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-11-18 17:26:55 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2008-11-29 11:20:34 +0000
commite6963a5bfebda69a1ef0a986cede84bcd955b6d4 (patch)
treea70bd8d15c60a71ba88bdf299244f93aa7b147d0 /src/cairo-output-stream.c
parentd1801c23fae3777c7c59e084894a3410f7a1f932 (diff)
Mark allocation failures as unlikely.
Use the gcc likelihood annotation to indicate that allocation failures are extremely unlikely.
Diffstat (limited to 'src/cairo-output-stream.c')
-rw-r--r--src/cairo-output-stream.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/cairo-output-stream.c b/src/cairo-output-stream.c
index 780bd50c..71154339 100644
--- a/src/cairo-output-stream.c
+++ b/src/cairo-output-stream.c
@@ -147,7 +147,7 @@ _cairo_output_stream_create (cairo_write_func_t write_func,
cairo_output_stream_with_closure_t *stream;
stream = malloc (sizeof (cairo_output_stream_with_closure_t));
- if (stream == NULL) {
+ if (unlikely (stream == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_output_stream_t *) &_cairo_output_stream_nil;
}
@@ -173,7 +173,7 @@ _cairo_output_stream_create_in_error (cairo_status_t status)
return (cairo_output_stream_t *) &_cairo_output_stream_nil_write_error;
stream = malloc (sizeof (cairo_output_stream_t));
- if (stream == NULL) {
+ if (unlikely (stream == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_output_stream_t *) &_cairo_output_stream_nil;
}
@@ -598,7 +598,7 @@ _cairo_output_stream_create_for_file (FILE *file)
}
stream = malloc (sizeof *stream);
- if (stream == NULL) {
+ if (unlikely (stream == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_output_stream_t *) &_cairo_output_stream_nil;
}
@@ -632,7 +632,7 @@ _cairo_output_stream_create_for_filename (const char *filename)
}
stream = malloc (sizeof *stream);
- if (stream == NULL) {
+ if (unlikely (stream == NULL)) {
fclose (file);
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_output_stream_t *) &_cairo_output_stream_nil;
@@ -676,7 +676,7 @@ _cairo_memory_stream_create (void)
memory_stream_t *stream;
stream = malloc (sizeof *stream);
- if (stream == NULL) {
+ if (unlikely (stream == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_output_stream_t *) &_cairo_output_stream_nil;
}
@@ -703,7 +703,7 @@ _cairo_memory_stream_destroy (cairo_output_stream_t *abstract_stream,
*length_out = _cairo_array_num_elements (&stream->array);
*data_out = malloc (*length_out);
- if (*data_out == NULL) {
+ if (unlikely (*data_out == NULL)) {
status = _cairo_output_stream_destroy (abstract_stream);
assert (status == CAIRO_STATUS_SUCCESS);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@@ -753,7 +753,7 @@ _cairo_null_stream_create (void)
cairo_output_stream_t *stream;
stream = malloc (sizeof *stream);
- if (stream == NULL) {
+ if (unlikely (stream == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_output_stream_t *) &_cairo_output_stream_nil;
}