summaryrefslogtreecommitdiff
path: root/lib/exceptions.c
diff options
context:
space:
mode:
authorPixel <>2001-04-17 04:05:52 +0000
committerPixel <>2001-04-17 04:05:52 +0000
commit5aed7634c8993e3366817c4b20fca1aa18eacf21 (patch)
treecfb6c00a13b8f213255ea231a3d814f61ab2964b /lib/exceptions.c
parent55f981c9fca048fba18d0538be4ed5dc1cc3fe11 (diff)
Indentation plus faible
Diffstat (limited to 'lib/exceptions.c')
-rw-r--r--lib/exceptions.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/lib/exceptions.c b/lib/exceptions.c
index b86fb9f..adef5ee 100644
--- a/lib/exceptions.c
+++ b/lib/exceptions.c
@@ -19,63 +19,63 @@ int clevel = 0;
char *Estrdup(char *o)
{
- char *r;
+ char *r;
- if (o) {
- if (!(r = strdup(o))) {
- exception(1, _("Out of memory."));
- }
- } else {
- return NULL;
+ if (o) {
+ if (!(r = strdup(o))) {
+ exception(1, _("Out of memory."));
}
- return r;
+ } else {
+ return NULL;
+ }
+ return r;
}
void *Emalloc(size_t s)
{
- void *r;
+ void *r;
- if (s) {
- if (!(r = malloc(s))) {
- exception(1, _("Out of memory."));
- }
- } else {
- return NULL;
+ if (s) {
+ if (!(r = malloc(s))) {
+ exception(1, _("Out of memory."));
}
- return r;
+ } else {
+ return NULL;
+ }
+ return r;
}
void pushcontext(char *c)
{
- if (clevel == 128) {
- exception(1, _("Too much error contexts during pushcontext()."));
- }
- contexts[clevel++] = Estrdup(c);
+ if (clevel == 128) {
+ exception(1, _("Too much error contexts during pushcontext()."));
+ }
+ contexts[clevel++] = Estrdup(c);
}
void popcontext(void)
{
- if (clevel == 0) {
- exception(1, _("Error context empty, but popcontext() called."));
- }
- free(contexts[--clevel]);
+ if (clevel == 0) {
+ exception(1, _("Error context empty, but popcontext() called."));
+ }
+ free(contexts[--clevel]);
}
void flushcontext(void)
{
- while (clevel) {
- popcontext();
- }
+ while (clevel) {
+ popcontext();
+ }
}
void exception(int level, char *msg)
{
- int i;
+ int i;
- fprintf(stderr, "Error detected. Showing context.\n");
- for (i = 0; i < clevel; i++) {
- fprintf(stderr, " (%i) - %s\n", i, contexts[i]);
- }
- fprintf(stderr, " Error description: %s\n", msg);
- exit(level);
+ fprintf(stderr, "Error detected. Showing context.\n");
+ for (i = 0; i < clevel; i++) {
+ fprintf(stderr, " (%i) - %s\n", i, contexts[i]);
+ }
+ fprintf(stderr, " Error description: %s\n", msg);
+ exit(level);
}