Ruby 4.1.0dev (2026-09-07 revision 7a095da06731b1463ea922aa6a96d0b3fdb57635)
stringy.h
1#ifndef PRISM_INTERNAL_STRINGY_H
2#define PRISM_INTERNAL_STRINGY_H
3
4#include "prism/stringy.h"
5
6/*
7 * Defines an empty string. This is useful for initializing a string that will
8 * be filled in later.
9 */
10#define PM_STRING_EMPTY ((pm_string_t) { .type = PM_STRING_CONSTANT, .source = NULL, .length = 0 })
11
12/*
13 * Initialize a shared string that is based on initial input.
14 */
15void pm_string_shared_init(pm_string_t *string, const uint8_t *start, const uint8_t *end);
16
17/*
18 * Compare the underlying lengths and bytes of two strings. Returns 0 if the
19 * strings are equal, a negative number if the left string is less than the
20 * right string, and a positive number if the left string is greater than the
21 * right string.
22 */
23int pm_string_compare(const pm_string_t *left, const pm_string_t *right);
24
25/*
26 * Free the associated memory of the given string.
27 */
28void pm_string_cleanup(pm_string_t *string);
29
30#endif
A generic string type that can have various ownership semantics.
A generic string type that can have various ownership semantics.
Definition stringy.h:18