Test coverage: make LCOV ignore sig_handler and OOM check
[open-adventure.git] / misc.c
diff --git a/misc.c b/misc.c
index e7a03984b0fb96739797499247b797e49e984166..b01662f5120f4739cea47623b433c7e15ae58cc2 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -15,8 +15,11 @@ void* xmalloc(size_t size)
 {
     void* ptr = malloc(size);
     if (ptr == NULL) {
+        // LCOV_EXCL_START
+        // exclude from coverage analysis because we can't simulate an out of memory error in testing
         fprintf(stderr, "Out of memory!\n");
         exit(EXIT_FAILURE);
+        // LCOV_EXCL_STOP 
     }
     return (ptr);
 }
@@ -41,18 +44,6 @@ void packed_to_token(long packed, char token[6])
     }
 }
 
-void token_to_packed(char token[6], long* packed)
-{
-  *packed = 0;
-  for (size_t i = 0; i < 5; ++i)
-    {
-      if (token[4 - i] == '\0')
-       continue;       
-      char mapped = ascii_to_advent[(int) token[4 - i]];
-      *packed |= (mapped << (6 * i));
-    }
-}
-
 /* Hide the fact that wods are corrently packed longs */
 
 bool wordeq(token_t a, token_t b)