libk  Diff

Differences From Artifact [09be45a2b3]:

To Artifact [bec7e80543]:


     8      8   
     9      9   #ifdef __cplusplus
    10     10   extern "C" {
    11     11   #endif
    12     12   
    13     13   typedef enum kmcond {
    14     14   	kmcond_ok,
           15  +	kmcond_unnecessary,
           16  +
           17  +	kmcond_fail,
           18  +	kmcond_unhandled,
           19  +	kmcond_mismatch,
    15     20   	kmcond_bad_address,
    16     21   } kmcond;
    17     22   
    18     23   typedef enum kmkind {
    19     24   	kmkind_none,
           25  +	kmkind_fail,
           26  +	kmkind_linear,
    20     27   	kmkind_heap,
    21     28   	kmkind_pool,
    22     29   	kmkind_ref,
    23     30   	kmkind_tree
    24     31   } kmkind;
    25     32   
    26     33   typedef enum kmshred {
    27     34   	kmshred_yes,
    28     35   	kmshred_no
    29     36   } kmshred;
    30     37   
    31         -typedef struct kmcell {
           38  +typedef struct kmbox {
    32     39   	kmkind kind;
    33     40   	sz size;
    34     41   	kmshred shred;
           42  +} kmbox;
           43  +
           44  +typedef struct kmcell {
           45  +	kmbox header;
    35     46   	sz refs;
    36     47   	struct kmcell* src;
    37     48   } kmcell;
           49  +
           50  +typedef struct kmnode {
           51  +	kmbox header;
           52  +	struct kmnode* origin,
           53  +		         * branch,
           54  +				 * next,
           55  +				 * prev;
           56  +} kmnode;
    38     57   
    39     58   typedef struct kmptr {
    40     59   	kmkind kind;
    41     60   	kmshred shred;
    42     61   	void* ref;
    43         -	kmcell* cell;
    44     62   } kmptr;
    45     63   
    46     64   /* heap functions */
    47     65   
    48     66   void*  kmheapa(sz);
           67  +kmptr  kmheapao(sz);
    49     68   kmcond kmheapf(void*);
           69  +
           70  +/* generic functions */
           71  +
           72  +kmcond kmfree(kmptr);
           73  +kmkind kmtell(void*);
           74  +void kmzero(void*,sz);
           75  +void kmozero(kmptr);
           76  +
    50     77   
    51     78   #ifdef __cplusplus
    52     79   }
    53     80   #endif
    54     81   
    55     82   #endif