Cleanup and augment string handling based on https://github.com/mono/mono/pull/15522.
authorJay Krell <jaykrell@microsoft.com>
Wed, 3 Jul 2019 02:55:10 +0000 (19:55 -0700)
committerLarry Ewing <lewing@microsoft.com>
Wed, 4 Sep 2019 03:46:10 +0000 (22:46 -0500)
commit0bae068a92d5df3d5274c1d9b78a16f94dce0cbd
tree8f82ea7977aa2cd730ff7490e7641c70d0b634ca
parent0817aeed597a61074d0434ce7c3d09338fc16f4c
Cleanup and augment string handling based on https://github.com/mono/mono/pull/15522.

1. When comparing strings, check pointer equality.
Faster when they match, slower when they do not.

2. Provide string lowercasing into a provided buffer, which can equal
the input, to avoid extra malloc/free.

3. define G_STRING_CONSTANT_AND_LENGTH(x) (x), G_N_ELEMENTS (x) - 1
e.g. strncmp (foo, G_STRING_CONSTANT_AND_LENGTH ("version"))

Commit migrated from https://github.com/mono/mono/commit/8c288f06664c65050b153da0a8952209adc958a0
src/mono/mono/eglib/eglib-remap.h
src/mono/mono/eglib/glib.h
src/mono/mono/eglib/gstr.c