From 7db2e9ea38329b9393c9e8cc905b180735c9b0f4 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Tue, 26 Jun 2018 10:46:10 +0430 Subject: [PATCH] Minor on hb_blob_create_from_file Add one more "unlikely" annotation and use explicit nullptr check for more consistency. --- src/hb-blob.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hb-blob.cc b/src/hb-blob.cc index 37a6d8cbc..155c2e6b1 100644 --- a/src/hb-blob.cc +++ b/src/hb-blob.cc @@ -597,7 +597,7 @@ fail_without_close: int len = 0; int allocated = BUFSIZ * 16; char *blob = (char *) malloc (allocated); - if (blob == nullptr) return hb_blob_get_empty (); + if (unlikely (blob == nullptr)) return hb_blob_get_empty (); FILE *fp = fopen (file_name, "rb"); if (unlikely (fp == nullptr)) goto fread_fail_without_close; @@ -611,7 +611,7 @@ fail_without_close: // can cover files like that but lets limit our fallback reader if (unlikely (allocated > 200000000)) goto fread_fail; char *new_blob = (char *) realloc (blob, allocated); - if (unlikely (!new_blob)) goto fread_fail; + if (unlikely (new_blob == nullptr)) goto fread_fail; blob = new_blob; }