MCPcopy Create free account
hub / github.com/RsyncProject/rsync / makefixed

Function makefixed

zlib/inflate.c:310–347  ·  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

308 a.out > inffixed.h
309 */
310void makefixed()
311{
312 unsigned low, size;
313 struct inflate_state state;
314
315 fixedtables(&state);
316 puts(" /* inffixed.h -- table for decoding fixed codes");
317 puts(" * Generated automatically by makefixed().");
318 puts(" */");
319 puts("");
320 puts(" /* WARNING: this file should *not* be used by applications.");
321 puts(" It is part of the implementation of this library and is");
322 puts(" subject to change. Applications should only use zlib.h.");
323 puts(" */");
324 puts("");
325 size = 1U << 9;
326 printf(" static const code lenfix[%u] = {", size);
327 low = 0;
328 for (;;) {
329 if ((low % 7) == 0) printf("\n ");
330 printf("{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op,
331 state.lencode[low].bits, state.lencode[low].val);
332 if (++low == size) break;
333 putchar(',');
334 }
335 puts("\n };");
336 size = 1U << 5;
337 printf("\n static const code distfix[%u] = {", size);
338 low = 0;
339 for (;;) {
340 if ((low % 6) == 0) printf("\n ");
341 printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits,
342 state.distcode[low].val);
343 if (++low == size) break;
344 putchar(',');
345 }
346 puts("\n };");
347}
348#endif /* MAKEFIXED */
349
350/*

Callers

nothing calls this directly

Calls 1

fixedtablesFunction · 0.85

Tested by

no test coverage detected