Mercurial > hg > dmlib
comparison dmres.c @ 107:1c2ff205fa0e
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 03 Oct 2012 09:29:29 +0300 |
parents | 23ac82365a65 |
children | e9de22e5a6d5 |
comparison
equal
deleted
inserted
replaced
106:93fbce0e6591 | 107:1c2ff205fa0e |
---|---|
870 } | 870 } |
871 | 871 |
872 | 872 |
873 /* Resources subsystem initialization and shutdown routines | 873 /* Resources subsystem initialization and shutdown routines |
874 */ | 874 */ |
875 int dmres_init(const char *filename, const char *path, int flags, int (*classifier)(DMResource *)) | 875 int dmres_init(const char *filename, const char *path, const int flags, int (*classifier)(DMResource *)) |
876 { | 876 { |
877 // Check if we are already initialized | 877 // Check if we are already initialized |
878 if (dfResInitialized) | 878 if (dfResInitialized) |
879 return DMERR_ALREADY_INIT; | 879 return DMERR_ALREADY_INIT; |
880 | 880 |
881 dfResFlags = flags; | 881 dfResFlags = flags; |
882 dfResPath = dm_strdup((path != NULL) ? path : DMRES_DATA_PATH); | 882 dfResPath = dm_strdup((path != NULL) ? path : DMRES_DATA_PATH); |
883 dfResourcesMutex = dmCreateMutex(); | 883 dfResourcesMutex = dmCreateMutex(); |
884 | |
884 | 885 |
885 if (flags & DRF_USE_PACK) | 886 if (flags & DRF_USE_PACK) |
886 { | 887 { |
887 #ifdef DMRES_PACKFS | 888 #ifdef DMRES_PACKFS |
888 int ret; | 889 int ret; |
936 DMResource *node; | 937 DMResource *node; |
937 for (node = dfResources; node != NULL; node = node->next) | 938 for (node = dfResources; node != NULL; node = node->next) |
938 { | 939 { |
939 int ret = classifier(node); | 940 int ret = classifier(node); |
940 if (ret != DMERR_OK) | 941 if (ret != DMERR_OK) |
941 return DMERR_INIT_FAIL; | 942 return ret; |
942 } | 943 } |
943 } | 944 } |
944 | 945 |
945 // Initialization complete | 946 // Initialization complete |
946 dfResInitialized = TRUE; | 947 dfResInitialized = TRUE; |