00001 #ifndef MICROFEEDMISC_H 00002 #define MICROFEEDMISC_H 00003 00004 #include <stdlib.h> 00005 #include <sys/types.h> 00006 #include <dirent.h> 00007 00021 typedef struct _MicrofeedWeakReference MicrofeedWeakReference; 00022 00023 MicrofeedWeakReference* microfeed_weak_reference_new(void* referenced, MicrofeedWeakReference* existing_weak_reference); 00024 void microfeed_weak_reference_free(MicrofeedWeakReference* weak_refeference); 00025 void* microfeed_weak_reference_get_impl(MicrofeedWeakReference* weak_reference); 00026 #define microfeed_weak_reference_get(w, t) ((t*)microfeed_weak_reference_get_impl(w)) 00027 void microfeed_weak_reference_invalidate(MicrofeedWeakReference* weak_reference); 00028 00029 #define microfeed_memory_allocate(t) ((t*)microfeed_memory_allocate_bytes(sizeof(t))) 00030 void* microfeed_memory_allocate_bytes(size_t size); 00031 #define microfeed_memory_allocate_with_strings(t,...) ((t*)microfeed_memory_allocate_with_strings_impl(sizeof(t),__VA_ARGS__)) 00032 /* #define microfeed_memory_free(p) free(p) */ 00033 void microfeed_memory_free(void* p); 00034 00035 char* microfeed_util_string_concatenate(const char* s, ...); 00036 char* microfeed_util_string_percent_encoding_escape(const char* s); 00037 char* microfeed_util_string_percent_encoding_unescape(const char* s); 00038 char* microfeed_util_string_base64_encode(const char* s, size_t length); 00039 size_t microfeed_util_string_starts_with(const char* s, const char* prefix); 00040 00041 int microfeed_util_create_directory_recursively(const char* directory); 00042 00048 #endif