17 points | by dimonomid 2 days ago ago
2 comments
Please be aware that pointer arithmetic is not defined on void * pointers, although many compilers allow it. You had better use char * for "data".
Also, your code is prone to overflow when you add data, used, alignment and size.
And finally, the realloc function could be reworked to do nothing if new_size is <= old_size.
Why redefine the stdints?
Please be aware that pointer arithmetic is not defined on void * pointers, although many compilers allow it. You had better use char * for "data".
Also, your code is prone to overflow when you add data, used, alignment and size.
And finally, the realloc function could be reworked to do nothing if new_size is <= old_size.
Why redefine the stdints?