ic-proxy: type checking in ic_proxy_new()
A typical mistake on allocating typed memory is as below:
int64 *ptr = malloc(sizeof(int32));
To prevent this, now we make ic_proxy_new() a typed allocator, it always
return a pointer of the specified type, for example:
int64 *p1 = ic_proxy_new(int64); /* good */
int64 *p2 = ic_proxy_new(int32); /* bad, gcc will raise a warning */
Reviewed-by: NHubert Zhang <hzhang@pivotal.io>
Showing
想要评论请 注册 或 登录