Artifact cc32756862a7a376e969afd5f98e4f3541fb2bc9cbeb0764067d9337b1a4465c:
- File kmem/free.fn.c — part of check-in [a8d93823f1] at 2019-08-18 13:42:35 on branch trunk — add functions, generate C syscall table (user: lexi, size: 524) [annotate] [blame] [check-ins using]
- File mod/kmem/free.fn.c — part of check-in [14172a910a] at 2019-08-21 06:00:24 on branch trunk — move modules to a subdirectory in order to keep the directory tree organized and make room for OS-specific build files (user: lexi, size: 524) [annotate] [blame] [check-ins using]
#include <k/mem.h> #include <k/core.h> #include <k/def.h> #include <k/type.h> /* free.fn.c - kmfree() "arbitrary free" * ~ lexi hale <lexi@hale.su> * kmfree() frees memory allocated in any manner. * it ignores non-dynamically allocated memory, * returning kmcond_unnecessary. to check for * success, compare result < kmcond_fail. */ kmcond kmfree(kmptr ptr) { if (ptr.kind <= kmkind_fail) return kmcond_unnecessary; switch (ptr.kind) { case kmkind_heap: return kmheapf(ptr.ref); } return kmcond_unhandled; }