Fully rewrite dictstat logic to make it possible to pack it into a module
This commit is contained in:
@@ -12,6 +12,9 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <search.h>
|
||||
|
||||
#define MAX_DICTSTAT 10000
|
||||
|
||||
typedef struct
|
||||
@@ -28,6 +31,27 @@ typedef struct
|
||||
|
||||
} dictstat_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *filename;
|
||||
|
||||
dictstat_t *base;
|
||||
|
||||
#if defined (_POSIX)
|
||||
size_t cnt;
|
||||
#else
|
||||
uint cnt;
|
||||
#endif
|
||||
|
||||
} dictstat_ctx_t;
|
||||
|
||||
int sort_by_dictstat (const void *s1, const void *s2);
|
||||
|
||||
void dictstat_init (dictstat_ctx_t *dictstat_ctx, char *profile_dir);
|
||||
void dictstat_destroy (dictstat_ctx_t *dictstat_ctx);
|
||||
void dictstat_read (dictstat_ctx_t *dictstat_ctx);
|
||||
int dictstat_write (dictstat_ctx_t *dictstat_ctx);
|
||||
u64 dictstat_find (dictstat_ctx_t *dictstat_ctx, dictstat_t *d);
|
||||
void dictstat_append (dictstat_ctx_t *dictstat_ctx, dictstat_t *d);
|
||||
|
||||
#endif // _DICTSTAT_H
|
||||
|
||||
Reference in New Issue
Block a user