diff options
| author | Murilo Ijanc <[email protected]> | 2026-07-27 20:42:22 -0300 |
|---|---|---|
| committer | Murilo Ijanc <[email protected]> | 2026-07-27 20:44:20 -0300 |
| commit | c3b525537e944064869a2cd6495733388144ce64 (patch) | |
| tree | a30fa16568ffe470876f670e6bd75873c201df1a /Makefile | |
| parent | b7b08a7d29d84de187dd8a55e0c94de66b07a572 (diff) | |
| download | asm-c3b525537e944064869a2cd6495733388144ce64.tar.gz | |
A CEP that fails is almost never a random number. It is someone who knows
the city and guessed the last digits, and the guess is usually the -000 that
957 municipalities never received. The API answers those 404s with a faixa
object naming the municipality that owns the band, which turns "not found"
from a dead end into something the caller can act on - and the caller cannot
reach it through this library, because the 404 path never looked at the body
at all.
cepis_error is where a 404 already reports itself, so faixa goes there, as
inline storage rather than a pointer: the struct is documented as owning
nothing and declared on the caller's stack, and that stays true. It costs
sizeof(cepis_error), 272 bytes to 384, so 0.2.0 needs a recompile.
The parser needed one new primitive. cepis__json_field could only pull
scalars out of a flat object; splitting it over cepis__json_find, which
returns a pointer to a value of any shape, reaches one level down without
building a document tree - the same depth cepis__geo_parse already needs for
geo. Absence is the case that matters: no faixa, an empty one, or one that
is not an object all leave the error byte-for-byte what it was before.
cep_ini and cep_fim are deliberately not presented as a range. They are the
lowest and highest CEP that exist, the band is sparse - Areal's 118 CEPs are
scattered over ~4900 numbers - and ceps is the only honest count.
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -1,7 +1,10 @@ .POSIX: .SUFFIXES: -VERSION = 0.1.0 +VERSION = 0.2.0 +# Bumped to 1 in 0.2.0: cepis_error grew a faixa field, so a 0.1.0 binary +# that declares one on the stack would be written past its end. +SOVERSION = 1 PREFIX = /usr/local LIBDIR = $(PREFIX)/lib INCDIR = $(PREFIX)/include @@ -75,7 +78,7 @@ $(LIB): $(OBJ) ar rcs $@ $(OBJ) $(SO): $(OBJ) - $(CC) -shared -Wl,-soname,libcepis.so.0 -o $@ $(OBJ) $(LDLIBS) + $(CC) -shared -Wl,-soname,libcepis.so.$(SOVERSION) -o $@ $(OBJ) $(LDLIBS) $(DRIVER): tests/test_cepis.c tests/abi_probe.S $(LIB) include/cepis.h $(CC) $(CFLAGS) -o $@ tests/test_cepis.c tests/abi_probe.S $(LIB) \ @@ -116,6 +119,6 @@ install: build mkdir -p $(DESTDIR)$(LIBDIR) $(DESTDIR)$(INCDIR) cp $(LIB) $(DESTDIR)$(LIBDIR)/libcepis.a cp $(SO) $(DESTDIR)$(LIBDIR)/libcepis.so.$(VERSION) - ln -sf libcepis.so.$(VERSION) $(DESTDIR)$(LIBDIR)/libcepis.so.0 - ln -sf libcepis.so.0 $(DESTDIR)$(LIBDIR)/libcepis.so + ln -sf libcepis.so.$(VERSION) $(DESTDIR)$(LIBDIR)/libcepis.so.$(SOVERSION) + ln -sf libcepis.so.$(SOVERSION) $(DESTDIR)$(LIBDIR)/libcepis.so cp include/cepis.h $(DESTDIR)$(INCDIR)/cepis.h |