MCPcopy Create free account
hub / github.com/F-Stack/f-stack / makefixed

Function makefixed

freebsd/contrib/zlib/inflate.c:342–379  ·  view source on GitHub ↗

Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also defines BUILDFIXED, so the tables are built on the fly. makefixed() writes those tables to stdout, which would be piped to inffixed.h. A small program can simply call makefixed to do this: void makefixed(void); int main(void) { makefixed(); return 0; } Then that can be linke

Source from the content-addressed store, hash-verified

340 a.out > inffixed.h
341 */
342void makefixed()
343{
344 unsigned low, size;
345 struct inflate_state state;
346
347 fixedtables(&state);
348 puts(" /* inffixed.h -- table for decoding fixed codes");
349 puts(" * Generated automatically by makefixed().");
350 puts(" */");
351 puts("");
352 puts(" /* WARNING: this file should *not* be used by applications.");
353 puts(" It is part of the implementation of this library and is");
354 puts(" subject to change. Applications should only use zlib.h.");
355 puts(" */");
356 puts("");
357 size = 1U << 9;
358 printf(" static const code lenfix[%u] = {", size);
359 low = 0;
360 for (;;) {
361 if ((low % 7) == 0) printf("\n ");
362 printf("{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op,
363 state.lencode[low].bits, state.lencode[low].val);
364 if (++low == size) break;
365 putchar(',');
366 }
367 puts("\n };");
368 size = 1U << 5;
369 printf("\n static const code distfix[%u] = {", size);
370 low = 0;
371 for (;;) {
372 if ((low % 6) == 0) printf("\n ");
373 printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits,
374 state.distcode[low].val);
375 if (++low == size) break;
376 putchar(',');
377 }
378 puts("\n };");
379}
380#endif /* MAKEFIXED */
381
382/*

Callers

nothing calls this directly

Calls 3

putcharFunction · 0.85
fixedtablesFunction · 0.70
printfFunction · 0.50

Tested by

no test coverage detected