diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-06-23 13:04:09 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-06-23 13:12:09 +0000 |
| commit | 5fc8275eb2385933a1f068a4476ddfc28afce584 (patch) | |
| tree | 45c62197b5807ba18793bb2759617a5b7db2f8cb /scripts | |
| parent | changelog: add ref to #600 (-o,--override for footclient) (diff) | |
client: add and use function push_override()
We now track override data (length + malloc:ed string) in a struct,
and push this struct to our overrides linked list.
There’s a new function, push_override() that takes a string,
calculates its length, strdup() it and pushes it to the linked
list. This function also length-checks the string, to ensure we don’t
overflow.
This way, we don’t have to loop the overrides list twice; once when
calculating the total length of all overrides, and once when sending
the overrides to the server.
Now, we can update the total length as we add overrides (i.e while
parsing the command line, instead of afterwards).
This means we only have to loop the list once, and that’s when sending
it. This also means there’s no longer any need to malloc an array
holding the lengths of each override.
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions
