#include <gras/error.h>
#include <gras/log.h>
+#include <gras/module.h>
+
#include <gras/dynar.h>
#include <gras/dict.h>
--- /dev/null
+/* $Id$ */
+
+/* module - modularize the code */
+
+/* Authors: Martin Quinson */
+/* Copyright (C) 2004 the Martin Quinson. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef _GRAS_MODULE_H
+#define _GRAS_MODULE_H
+
+typedef struct gras_module_ gras_module_t;
+
+typedef gras_module_t (*gras_module_new_fct_t)(int argc, char **argv);
+typedef int (*gras_module_finalize_fct_t)(void);
+
+void gras_init(int argc,char **argv);
+void gras_finalize(void);
+#endif /* _GRAS_MODULE_H */
COMMON_S=\
\
+ core/module.c \
core/log.c core/log_default_appender.c core/error.c \
core/dynar.c \
core/dict.c core/dict_elm.c core/dict_cursor.c \
#include "gras/error.h"
#include "gras/log.h"
+#include "gras/module.h"
#include "gras/dynar.h"
#include "gras/dict.h"
#include "gras/config.h"
}
}
}
+ free(key);
printf("\n Remove my 200 000 elements. (a point is 10 000 elements)\n");
if (!(key=malloc(10))) {
fprintf(stderr,"Out of memory\n");
- return 3;
+ abort();
}
for (j=0;j<NB_ELM;j++) {
if (!(j%10000)) printf("."); fflush(stdout);
TRYFAIL(gras_dict_remove(head,key));
}
printf("\n");
+ free(key);
printf("\n Free the structure (twice)\n");
gras_dict_free(&head);
printf(" Free the dictionnary again\n");
gras_dict_free(&head);
-
+
TRYFAIL(fill(&head));
printf(" - Change some values\n");
printf(" Free the dictionnary (twice)\n");
gras_dict_free(&head);
- gras_dict_free(&head); // frees it twice to see if it triggers an error
+ gras_dict_free(&head);
printf(" - Traverse the resulting dictionnary\n");
TRYFAIL(traverse(head));
TRYEXPECT(debuged_remove(head,"Does not exist"),mismatch_error);
TRYFAIL(traverse(head));
+ gras_dict_free(&head);
+ gras_finalize();
+ return 0;
+
TRYCATCH(debuged_remove(head,"12345"),mismatch_error);
TRYFAIL(traverse(head));
printf(" - Free the dictionnary twice\n");
gras_dict_free(&head);
gras_dict_free(&head);
- printf("Done\n");
- fflush(stdout);
return 0;
}
}
gras_dynar_free(d);
+ gras_finalize();
return 0;
}
CDEBUG2(Top, "val=%d%s", 3, "!");
CRITICAL6("false alarm%s%s%s%s%s%s", "","","","","","!");
+ gras_finalize();
return 0;
}