Skip to content

use a list instead of a fixed size array for 16 reader states

src/readerfactory.c uses:

static READER_CONTEXT * sReadersContexts[PCSCLITE_MAX_READERS_CONTEXTS];
READER_STATE readerStates[PCSCLITE_MAX_READERS_CONTEXTS];

A list should be used instead of the default limitation to 16 readers.

With few readers (1 or 2) the RAM consumption should be lower.

  • sizeof(struct ReaderContext) = 440

  • sizeof(sReadersContexts) = 440*16 = 7040

  • sizeof(struct pubReaderStatesList) = 184

  • sizeof(readerStates) = 184 * 16 = 2944

Gain when only 1 reader is in use = (7040 - 440) + (2944 - 184) = 9360 arround 9 KB of RAM would be saved.

Copied from https://alioth.debian.org/tracker/index.php?func=detail&aid=313579&group_id=30105&atid=410088