obu-firmware builds against vanetza-idf from microbu-esp32c5/external, but that tree was gitignored, so a clone of this repository could not build the firmware it ships. It is now committed here as ordinary files in its own folder, microbu-esp32c5/: the colleague's commit cf4b99f plus the V2X2MAP bridge's signature verification (--trust) used on the bench. Nothing is fetched from or pushed to the colleague's repository; this repository and its remotes carry everything. The folder's own .gitignore keeps build output, downloaded components and private key material out, as it did there; the committed file set is identical to that repository's tracked files. The ESP32-C5 is still flashed from obu-firmware/, which only takes vanetza-idf from microbu-esp32c5/, so the two stay separate folders. FLASHING.md says how to take a newer version of the colleague's tree (copy it over the folder, rebuild, test, commit).
51 lines
1.1 KiB
C
51 lines
1.1 KiB
C
#include "asn_internal.h"
|
|
|
|
ssize_t
|
|
asn__format_to_callback(int (*cb)(const void *, size_t, void *key), void *key,
|
|
const char *fmt, ...) {
|
|
char scratch[64];
|
|
char *buf = scratch;
|
|
size_t buf_size = sizeof(scratch);
|
|
int wrote;
|
|
int cb_ret;
|
|
|
|
do {
|
|
va_list args;
|
|
va_start(args, fmt);
|
|
|
|
wrote = vsnprintf(buf, buf_size, fmt, args);
|
|
va_end(args);
|
|
if(wrote < (ssize_t)buf_size) {
|
|
if(wrote < 0) {
|
|
if(buf != scratch) FREEMEM(buf);
|
|
return -1;
|
|
}
|
|
break;
|
|
}
|
|
|
|
buf_size <<= 1;
|
|
if(buf == scratch) {
|
|
buf = MALLOC(buf_size);
|
|
if(!buf) {
|
|
return -1;
|
|
}
|
|
} else {
|
|
void *p = REALLOC(buf, buf_size);
|
|
if(!p) {
|
|
FREEMEM(buf);
|
|
return -1;
|
|
}
|
|
buf = p;
|
|
}
|
|
} while(1);
|
|
|
|
cb_ret = cb(buf, wrote, key);
|
|
if(buf != scratch) FREEMEM(buf);
|
|
if(cb_ret < 0) {
|
|
return -1;
|
|
}
|
|
|
|
return wrote;
|
|
}
|
|
|