ref: f13bf4d88bf6ab600d9b7faf524de685d3870ab6
parent: f5f5501c8ea833e2e40f4de72b733c4b50fe86dd
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Aug 9 12:58:05 EDT 2019
[libscc] Remove outdated bits about pack/unpack These functions were removed fom libscc long time ago but there were some functions that still were in the library and some declarations in scc.h.
--- a/include/scc/scc/scc.h
+++ b/include/scc/scc/scc.h
@@ -35,8 +35,4 @@
extern void *new(Alloc *allocp);
extern void delete(Alloc *allocp, void *p);
extern int casecmp(const char *s1, const char *s2);
-extern int lpack(unsigned char *dst, char *fmt, ...);
-extern int lunpack(unsigned char *src, char *fmt, ...);
-extern int bpack(unsigned char *dst, char *fmt, ...);
-extern int bunpack(unsigned char *src, char *fmt, ...);
extern unsigned genhash(char *name);
--- a/src/libscc/bpack.c
+++ /dev/null
@@ -1,64 +1,0 @@
-#include <ctype.h>
-#include <stdarg.h>
-
-#include <scc/scc.h>
-
-int
-bpack(unsigned char *dst, char *fmt, ...)
-{
- unsigned char *bp, *cp;
- unsigned s;
- unsigned long l;
- unsigned long long q;
- size_t n;
- int d;
- va_list va;
-
- bp = dst;
- va_start(va, fmt);
- while (*fmt) {
- switch (*fmt++) {
- case '\'':
- for (n = 0; isdigit(*fmt); n += d) {
- n *= 10;
- d = *fmt++ - '0';
- }
- cp = va_arg(va, unsigned char *);
- while (n--)
- *bp++ = *cp++;
- break;
- case 'c':
- *bp++ = va_arg(va, unsigned);
- break;
- case 's':
- s = va_arg(va, unsigned);
- *bp++ = s >> 8;
- *bp++ = s;
- break;
- case 'l':
- l = va_arg(va, unsigned long);
- *bp++ = l >> 24;
- *bp++ = l >> 16;
- *bp++ = l >> 8;
- *bp++ = l;
- break;
- case 'q':
- q = va_arg(va, unsigned long long);
- *bp++ = q >> 56;
- *bp++ = q >> 48;
- *bp++ = q >> 40;
- *bp++ = q >> 32;
- *bp++ = q >> 24;
- *bp++ = q >> 16;
- *bp++ = q >> 8;
- *bp++ = q;
- break;
- default:
- va_end(va);
- return -1;
- }
- }
- va_end(va);
-
- return bp - dst;
-}