Change the bounds-safe interface of free to byte_count 0.
Changes the original bounds-safe interface of free to byte_count of 0. We no longer need the extra version of free in checkedc_extensions. Fixes #290.
This commit is contained in:
Родитель
f506955558
Коммит
03871e5efd
|
@ -16,10 +16,4 @@ extern inline int strncmp_array_ptr(const char *src : count(n), const char *s2 :
|
|||
_Unchecked { return strncmp(src, s2, n); }
|
||||
}
|
||||
|
||||
// default free assumes at least one byte of memory, not always true for nt_arrays
|
||||
// TODO: Will be able to do nt_array_ptr<void> after polymorphism implemented
|
||||
extern inline void free_nt_array_ptr(void *pointer : byte_count(0)) {
|
||||
_Unchecked { free(pointer); }
|
||||
}
|
||||
|
||||
#endif /* __CHECKED_C_EXTENSIONS_H */
|
||||
|
|
|
@ -63,12 +63,7 @@ unsigned long long int strtoull(const char * restrict nptr :
|
|||
// TODO: express alignment constraints once where clauses have been added.
|
||||
void *aligned_alloc(size_t alignment, size_t size) : byte_count(size);
|
||||
void *calloc(size_t nmemb, size_t size) : byte_count(nmemb * size);
|
||||
void free(void *pointer : byte_count(1)); // for _Ptr and _Array_ptr
|
||||
// Note: there's a separate bounds-safe interface for freeing _Nt_array_ptr-
|
||||
// typed arguments (which by default have a byte_count of 0) in the
|
||||
// checkedc_extensions.h header file.
|
||||
|
||||
|
||||
void free(void *pointer : byte_count(0));
|
||||
void *malloc(size_t size) : byte_count(size);
|
||||
void *realloc(void *pointer : byte_count(1), size_t size) : byte_count(size);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче