Changeset 71fb5ac in mainline
- Timestamp:
- 2018-11-13T16:48:08Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fdc190f
- Parents:
- b60615b
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-11-11 17:49:01)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-11-13 16:48:08)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/malloc.c
rb60615b r71fb5ac 82 82 } 83 83 84 static void _check_sizes(size_t * size, size_t *alignment)84 static void _check_sizes(size_t *alignment, size_t *size) 85 85 { 86 86 assert(size); … … 121 121 static void *mem_alloc(size_t, size_t) __attribute__((malloc)); 122 122 123 static void *mem_alloc(size_t size, size_t alignment)123 static void *mem_alloc(size_t alignment, size_t size) 124 124 { 125 _check_sizes(& size, &alignment);125 _check_sizes(&alignment, &size); 126 126 127 127 if (size > (1 << SLAB_MAX_MALLOC_W)) { … … 141 141 * @param alignment Alignment used to call mem_alloc(). 142 142 */ 143 static void mem_free(void *ptr, size_t size, size_t alignment)143 static void mem_free(void *ptr, size_t alignment, size_t size) 144 144 { 145 145 if (!ptr) 146 146 return; 147 147 148 _check_sizes(& size, &alignment);148 _check_sizes(&alignment, &size); 149 149 150 150 if (size > (1 << SLAB_MAX_MALLOC_W)) { … … 160 160 void *malloc(size_t size) 161 161 { 162 void *obj = mem_alloc( size + _offset, alignof(max_align_t)) + _offset;162 void *obj = mem_alloc(alignof(max_align_t), size + _offset) + _offset; 163 163 164 164 /* Remember the allocation size just before the object. */ … … 176 176 */ 177 177 size_t size = ((size_t *) obj)[-1]; 178 mem_free(obj - _offset, size + _offset, alignof(max_align_t));178 mem_free(obj - _offset, alignof(max_align_t), size + _offset); 179 179 } 180 180
Note:
See TracChangeset
for help on using the changeset viewer.