<feed xmlns='http://www.w3.org/2005/Atom'>
<title>nsxiv/util.c, branch master</title>
<subtitle>Nsxiv image view custom build
</subtitle>
<id>https://git.krolyxon.com/nsxiv/atom?h=master</id>
<link rel='self' href='https://git.krolyxon.com/nsxiv/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.krolyxon.com/nsxiv/'/>
<updated>2023-03-11T12:37:04Z</updated>
<entry>
<title>apply clang-format</title>
<updated>2023-03-11T12:37:04Z</updated>
<author>
<name>NRK</name>
<email>nrk@disroot.org</email>
</author>
<published>2023-02-10T05:35:53Z</published>
<link rel='alternate' type='text/html' href='https://git.krolyxon.com/nsxiv/commit/?id=f2f4903de4bd3ce06c03dd66f0c9a7dda97a3550'/>
<id>urn:sha1:f2f4903de4bd3ce06c03dd66f0c9a7dda97a3550</id>
<content type='text'>
minus the bogus changes

Co-authored-by: Berke Kocaoğlu &lt;berke.kocaoglu@metu.edu.tr&gt;
</content>
</entry>
<entry>
<title>update copyright year</title>
<updated>2023-01-28T10:29:36Z</updated>
<author>
<name>NRK</name>
<email>nrk@disroot.org</email>
</author>
<published>2023-01-15T09:26:46Z</published>
<link rel='alternate' type='text/html' href='https://git.krolyxon.com/nsxiv/commit/?id=a051ad210dc0571ec581c89171dc25b9ab35f4be'/>
<id>urn:sha1:a051ad210dc0571ec581c89171dc25b9ab35f4be</id>
<content type='text'>
</content>
</entry>
<entry>
<title>use assertions instead of ignoring bogus arguments (#406)</title>
<updated>2023-01-28T10:27:40Z</updated>
<author>
<name>NRK</name>
<email>nrk@disroot.org</email>
</author>
<published>2023-01-28T10:27:40Z</published>
<link rel='alternate' type='text/html' href='https://git.krolyxon.com/nsxiv/commit/?id=01f3cf2e4778940a82001e48cfeec767841f52c4'/>
<id>urn:sha1:01f3cf2e4778940a82001e48cfeec767841f52c4</id>
<content type='text'>
instead of silently ignoring bogus arguments (i.e programming errors),
which can make debugging harder, it's better to assert them so that they
get caught faster in debug builds.

Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/406
Reviewed-by: explosion-mental &lt;explosion-mental@noreply.codeberg.org&gt;
</content>
</entry>
<entry>
<title>spawn(): search $PATH as well</title>
<updated>2023-01-09T05:08:02Z</updated>
<author>
<name>NRK</name>
<email>nrk@disroot.org</email>
</author>
<published>2022-10-28T17:17:06Z</published>
<link rel='alternate' type='text/html' href='https://git.krolyxon.com/nsxiv/commit/?id=16b966be3b6b63ad331d619df654ca1a2082974e'/>
<id>urn:sha1:16b966be3b6b63ad331d619df654ca1a2082974e</id>
<content type='text'>
makes this function more useful for other people writing patches such as
this: https://codeberg.org/nsxiv/nsxiv-extra/src/branch/master/patches/dmenu-search
</content>
</entry>
<entry>
<title>spawn(): improve performance and simplify API</title>
<updated>2023-01-09T05:07:24Z</updated>
<author>
<name>NRK</name>
<email>nrk@disroot.org</email>
</author>
<published>2022-06-22T03:28:07Z</published>
<link rel='alternate' type='text/html' href='https://git.krolyxon.com/nsxiv/commit/?id=49d11f0d1fae43ae1e5f61204ed051e889062767'/>
<id>urn:sha1:49d11f0d1fae43ae1e5f61204ed051e889062767</id>
<content type='text'>
posix_spawn() is designed especially for this purpose, and thus it's
much more lightweight and efficient than manually fork/dup/exec-ing.

on my system, it improves the performance of spawn() by about 10x. given
that we make frequent calls to potentially multiple scripts, the
increased efficiency will add up overtime.

using posix_spawn() also simplifies the logic quite a bit, despite the
very verbose function names. however it does make cleanup a bit more
complicated.

this patch uses the linux kernel style cleanup strategy [0] (which I'm
personally not a huge fan of, but it fits this situation quite nicely)
with a "stack-like" unwinding via `goto`-s.

additionally simplify the spawn() API by taking in {read,write}fd
pointers and returning the pid instead of using some custom struct.

this coincidently also fixes #299

[0]: https://www.kernel.org/doc/html/v4.10/process/coding-style.html?highlight=goto#centralized-exiting-of-functions
</content>
</entry>
<entry>
<title>code-style: misc changes (#374)</title>
<updated>2022-10-19T12:46:22Z</updated>
<author>
<name>NRK</name>
<email>nrk@disroot.org</email>
</author>
<published>2022-10-19T12:46:22Z</published>
<link rel='alternate' type='text/html' href='https://git.krolyxon.com/nsxiv/commit/?id=b11384a6942cdf3c6b6f55e0dcc0a438eff7158a'/>
<id>urn:sha1:b11384a6942cdf3c6b6f55e0dcc0a438eff7158a</id>
<content type='text'>
* ensure static variables comes after non-static ones
* remove depreciated DATA32 type
* prefer `sizeof(expression)` over `sizeof(Type)`.
* silence a -Wsign warning
* {gif,webp} loader: use a pointer to reduce code-noise
* gif loader: allocate in one place

Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/374
Reviewed-by: TAAPArthur &lt;taaparthur@noreply.codeberg.org&gt;
</content>
</entry>
<entry>
<title>don't assume positive argc</title>
<updated>2022-09-05T01:52:51Z</updated>
<author>
<name>NRK</name>
<email>nrk@disroot.org</email>
</author>
<published>2022-06-16T13:33:32Z</published>
<link rel='alternate' type='text/html' href='https://git.krolyxon.com/nsxiv/commit/?id=fbe186e79d2083a7bbd1588b317cd5782bc5ae73'/>
<id>urn:sha1:fbe186e79d2083a7bbd1588b317cd5782bc5ae73</id>
<content type='text'>
handle a rare, but possible case of argc being 0, in which case argv[0]
would be null.

note that both POSIX and ISO C standard allow argc to be 0 and in
practice this can be triggered via calling `exec(3)` family of functions
with NULL as the first `argv`.
</content>
</entry>
<entry>
<title>code-style: various cleanups (#356)</title>
<updated>2022-08-16T08:53:05Z</updated>
<author>
<name>NRK</name>
<email>nrk@disroot.org</email>
</author>
<published>2022-08-16T08:53:05Z</published>
<link rel='alternate' type='text/html' href='https://git.krolyxon.com/nsxiv/commit/?id=6578e6eb6533a6651bd88ecae7720aced88c8c2f'/>
<id>urn:sha1:6578e6eb6533a6651bd88ecae7720aced88c8c2f</id>
<content type='text'>
* run_key_handler: make the logic easier to follow
* remove timeout_t
  the typedef is not needed. inline the declaration similar to the other
  static structs.
* simplify estrdup
  reuse emalloc, instead of calling malloc and null-checking.
* win_clear: initialize `e` right away
* process_bindings: explicitly check against NULL
  most pointer checks in the codebase do explicit check.
* use a named constant instead of magic number
  also changes the padding from 3 to 4 bytes according to [0]. but i
  couldn't find any situtation where this mattered, so perhaps the current
  padding is enough. but doesn't hurt adding one more byte.

[0]: https://nullprogram.com/blog/2017/10/06/

Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/356
Reviewed-by: explosion-mental &lt;explosion-mental@noreply.codeberg.org&gt;
</content>
</entry>
<entry>
<title>sort and group includes</title>
<updated>2022-06-28T19:28:06Z</updated>
<author>
<name>NRK</name>
<email>nrk@disroot.org</email>
</author>
<published>2022-06-16T07:39:03Z</published>
<link rel='alternate' type='text/html' href='https://git.krolyxon.com/nsxiv/commit/?id=b162aee497ef9be3730f59bb0c9d974171bfebee'/>
<id>urn:sha1:b162aee497ef9be3730f59bb0c9d974171bfebee</id>
<content type='text'>
* includes are sorted alphabetically

* their grouping and layout is the following:
  - nsxiv.h will be the first include
  - followed by any internal headers (e.g "commands.h" "config.h")
  - followed by system headers (&lt;stdlib.h&gt; etc)
  - followed by third party headers (X.h libwebp etc)

* also add `llvm-include-order` check to clang-tidy so that it can catch
  unsorted includes during CI.
</content>
</entry>
<entry>
<title>code-style: cleanup includes</title>
<updated>2022-06-28T19:28:06Z</updated>
<author>
<name>NRK</name>
<email>nrk@disroot.org</email>
</author>
<published>2022-05-31T11:25:14Z</published>
<link rel='alternate' type='text/html' href='https://git.krolyxon.com/nsxiv/commit/?id=6d5a04005dd1dff12ebfe2e3a56912ec26718f3f'/>
<id>urn:sha1:6d5a04005dd1dff12ebfe2e3a56912ec26718f3f</id>
<content type='text'>
* rm unused include &lt;sys/types.h&gt;
* move &lt;sys/time.h&gt; to main.c, it's the only file that needs it.
* move TV_* macros to main.c
* let *.c files explicitly include what they need instead of including
  them at nsxiv.h
</content>
</entry>
</feed>
