未验证 提交 7db2e9ea 编写于 作者: E Ebrahim Byagowi 提交者: GitHub

Minor on hb_blob_create_from_file

Add one more "unlikely" annotation and use explicit nullptr check for more consistency.
上级 4f875346
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册