(MOD) Fixed 1 bug in Memory_Reallocate: Now the size of inst is updating with the given size used for reallocation.
(MOD) Replaced struct member prev from UnknownStatus, NormalStatus and ErrorStatus from NULL to &UnknownStatus, &NormalStatus and &ErrorStatus. (MOD) Rewrote Status_Equal, StatusUtils_Dump, StatusUtils_IsRecursive and StatusUtils_Depth in response to the change of struct member prev from UnknownStatus, NormalStatus and ErrorStatus. (MOD) Defined 1 more macro "shift".
This commit is contained in:
22
common.h
22
common.h
@@ -43,13 +43,13 @@
|
||||
/* Execute b whenever finds s is "NOT okay". */
|
||||
# define notok(s, b) { Status _ = s; if (!StatusUtils_IsOkay(_)) b }
|
||||
|
||||
/* Return e when passing a failing e commented with c. */
|
||||
# define fails(e, c) { notok(e, return annot(_, c);) }
|
||||
|
||||
/* Return e when passing a failing e. */
|
||||
# define fail(e) { notok(e, return _;) }
|
||||
|
||||
/* Return v when passing a failing e. */
|
||||
/* Return e when passing a failing e commented with c. */
|
||||
# define fails(e, c) { notok(e, return annot(_, c);) }
|
||||
|
||||
/* Return value "v" when passing a failing e. */
|
||||
# define vfail(e, v) { notok(e, return v;) }
|
||||
|
||||
/* Execute b for handling UnknownStatus (TraditionalFunctionReturn). */
|
||||
@@ -123,6 +123,7 @@
|
||||
.prev = (Status *)&p\
|
||||
})
|
||||
|
||||
/* Create a new Status with v as its value. */
|
||||
# define value(e, v) ((Status) {\
|
||||
.identity = e.identity,\
|
||||
.value = v,\
|
||||
@@ -132,6 +133,17 @@
|
||||
.prev = (Status *)e.prev\
|
||||
})
|
||||
|
||||
/* Change the characteristic of e. */
|
||||
# define shift(e, c) ((Status) {\
|
||||
.identity = e.identity,\
|
||||
.value = e.value,\
|
||||
.description = e.description,\
|
||||
.characteristic = c,\
|
||||
.loc = e.loc,\
|
||||
.prev= (Status *)e.prev\
|
||||
})
|
||||
|
||||
/* Apply a new location to e where this macro is called. */
|
||||
# define apply(e) ((Status) {\
|
||||
.identity = e.identity,\
|
||||
.value = e.value,\
|
||||
@@ -141,7 +153,7 @@
|
||||
.prev = (Status *)e.prev\
|
||||
})
|
||||
|
||||
// Reannotate for e.
|
||||
/* Replace the description from e with c. */
|
||||
# define annot(e, c) ((Status) {\
|
||||
.identity = e.identity,\
|
||||
.value = e.value,\
|
||||
|
Reference in New Issue
Block a user