summaryrefslogtreecommitdiff
path: root/sfeed_gopher.c
AgeCommit message (Collapse)Author
2021-01-10optimize converting UNIX timestamp to localtimeHiltjo Posthuma
Make a huge difference (cuts the time in half to process the same amount of lines) on atleast glibc 2.30 on Void Linux. Seems to make no difference on OpenBSD. - This removes atleast one heap allocation per line (checked with valgrind). This is because glibc will strdup() the environment variable $TZ and free it each time, which is pointless here and wasteful. - localtime_r does not require to set the variables like tzname. In glibc-2.30/time/tzset.c in __tz_convert is the following code and comment: /* Update internal database according to current TZ setting. POSIX.1 8.3.7.2 says that localtime_r is not required to set tzname. This is a good idea since this allows at least a bit more parallelism. */ tzset_internal (tp == &_tmbuf && use_localtime); This makes it always tzset() and inspect the environment $TZ etc. While with localtime_r it will only initialize it once: static void tzset_internal (int always) { [...] if (is_initialized && !always) return;
2021-01-08sfeed_gopher: optimize common output character functionHiltjo Posthuma
Same reason as the previous commit (allow to expand to macros).
2021-01-01sfeed_gopher: tighten filesystem permissions on OpenBSD using unveil(2)Hiltjo Posthuma
sfeed_gopher must be able to write in the current directory, but does not need write permissions outside it. It could read from any place in the filesystem (to read feed files). Prompted by a suggestion from vejetaryenvampir, thanks!
2020-07-05format tools: don't skip items with a missing/invalid timestamp fieldHiltjo Posthuma
Handle it appropriately in the context of each format tool. Output the item but keep it blanked. NOTE: maybe in sfeed_twtxt it should use the current time instead?
2020-05-13sfeed_gopher: if a gopher url cannot be parsed then show it anyway as a "URL:"Hiltjo Posthuma
This should never be able to happen though in practise because sfeed parses the uri aswell.
2020-05-13sfeed_gopher: do not use URL: prefix for gopher:// urls.Hiltjo Posthuma
Support the Gopher protocol directly and use the specified Gopher type. Idea by adc, thanks!
2020-04-01util: improve/cleanup parseline()Hiltjo Posthuma
- remove a check that has no use/can never happen. - remove the return value as it's unused and the input size is known. - fix an old comment that doesn't reflect what the function does anymore.
2020-01-24cleanup some includesHiltjo Posthuma
2020-01-18add sfeed_gopher: generic gopher formatting program, remove sfeed_gphHiltjo Posthuma