static CONDITION checkObject(PRIVATE_OBJECT ** object, char *caller) { if (object == NULL) return COND_PushCondition(DCM_NULLOBJECT, DCM_Message(DCM_NULLOBJECT), caller); if (*object == NULL) return COND_PushCondition(DCM_NULLOBJECT, DCM_Message(DCM_NULLOBJECT), caller); if (strcmp((*object)->keyType, KEY_DCM_OBJECT) != 0) return COND_PushCondition(DCM_ILLEGALOBJECT, DCM_Message(DCM_ILLEGALOBJECT), caller); return DCM_NORMAL; }
CONDITION DCM_ListToString(LST_HEAD * list, long offset, char **string) { GENERIC * g; char *c, *p; long length; *string = NULL; if (list == NULL) return DCM_NORMAL; g = LST_Head(&list); if (g == NULL) return DCM_NORMAL; (void) LST_Position(&list, g); length = 0; while (g != NULL) { c = ((char *) g) + offset; length += strlen(c) + 1; g = LST_Next(&list); } p = CTN_MALLOC(length); if (p == NULL) return COND_PushCondition(DCM_MALLOCFAILURE, DCM_Message(DCM_MALLOCFAILURE), length, "DCM_ListToString"); *string = p; g = LST_Head(&list); if (g == NULL) return COND_PushCondition(DCM_LISTFAILURE, DCM_Message(DCM_LISTFAILURE), "DCM_ListToString"); (void) LST_Position(&list, g); length = 0; while (g != NULL) { c = ((char *) g) + offset; length = strlen(c); (void) memcpy(p, c, length); p += length; *p++ = '\\'; g = LST_Next(&list); } *--p = '\0'; return DCM_NORMAL; }