]> Lady’s Gitweb - CGirls/commit
Improve handling of strings
authorLady <redacted>
Wed, 19 Mar 2025 01:06:31 +0000 (21:06 -0400)
committerLady <redacted>
Thu, 20 Mar 2025 04:22:48 +0000 (00:22 -0400)
commitf5006884a1f4f37bc3c27ab1f3b882d2b36cd052
treebdeeea8c050de74cbc1902fbb1fb75a94850df91
parentf6f2fd79a596ecedaadd8b605b7de9d8c662151c
Improve handling of strings

• String constants are now defined with `constexpr´. Because these are
(associated at runtime with) `char const*const´ values, they can be
compared more‐or‐less like the old enum values used to be; because
those pointers point to actual strings, the code for processing them
and serializing them is simplified quite a bit. A few arrays give the
list of available strings; these are ⹐not⹑ (cannot be) `constexpr´s
because while the strings themselves are known at compile time, the
pointers which point to them cannot be. Instead, they are
`static const*const´ arrays; the `static´ keyword keeps their
visibility internal.

⋯ Exceptionally, `cgirls_mtype_any´ is defined as `nullptr´ rather
  than a string of zero length; handling this should always be a
  special case.

• Most of the verbs have been commented out to reduce the amount of
  code needed for an initial working implementation.

• The path·info parsing code has been refactored a bit, making use of a
  new function, `cgirls_gobblepath´ to encapsulate the task of reading
  up thru the next slash. The serialization code has also been
  refactored here and there for tidiness.

• Some comments in `request.c´ used spaces instead of tabs. Whoops!

Note that Clang only supports `constexpr´ in version 19 and later.
expect/pathinfo/09-canonical
expect/pathinfo/10-blushypath
request.c
request.h
test/pathinfo/09-canonical
test/pathinfo/10-blushypath
This page took 0.186096 seconds and 4 git commands to generate.