diff options
author | June McEnroe <june@causal.agency> | 2020-04-10 15:05:34 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-04-10 15:05:34 -0400 |
commit | 63ea8a358b5d6a61cad98fcc6259e89833887e0f (patch) | |
tree | 482280934077e52424d0e0d7980c7a88e44cfa73 | |
parent | Move parseEnvelope to parse.c (diff) | |
download | bubger-63ea8a358b5d6a61cad98fcc6259e89833887e0f.tar.gz bubger-63ea8a358b5d6a61cad98fcc6259e89833887e0f.zip |
Clean up exportData
Diffstat (limited to '')
-rw-r--r-- | export.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/export.c b/export.c index c563c3f..d6c7260 100644 --- a/export.c +++ b/export.c @@ -20,9 +20,7 @@ #include <stdint.h> #include <stdio.h> #include <stdlib.h> -#include <string.h> #include <sysexits.h> -#include <time.h> #include <unistd.h> #include "archive.h" @@ -97,18 +95,20 @@ void exportData(struct List items) { } else { errx(EX_PROTOCOL, "invalid data item name"); } - - if (name == AtomBody) { - i--; - continue; - } else if (name == AtomUID) { - uid = dataCheck(items.ptr[i + 1], Number).number; - } else if (name == AtomEnvelope) { - parseEnvelope(&envelope, dataCheck(items.ptr[i + 1], List).list); - } else if (name == AtomHeaderFields) { - header = dataCheck(items.ptr[i + 1], String).string; - } else if (name == AtomText) { - body = dataCheck(items.ptr[i + 1], String).string; + + struct Data data = items.ptr[i + 1]; + switch (name) { + break; case AtomBody: + i--; + break; case AtomUID: + uid = dataCheck(data, Number).number; + break; case AtomEnvelope: + parseEnvelope(&envelope, dataCheck(data, List).list); + break; case AtomHeaderFields: + header = dataCheck(data, String).string; + break; case AtomText: + body = dataCheck(data, String).string; + break; default:; } } |