diff options
author | Kevin Newton <[email protected]> | 2023-09-27 12:24:48 -0400 |
---|---|---|
committer | Kevin Newton <[email protected]> | 2023-09-27 13:57:38 -0400 |
commit | 4f73a7c2f7ff16aa78cf0dec2d4c7f90a2c41c9b (patch) | |
tree | 3b6f0cedc858d46d30a28c6d03439d653884a915 /prism/util/pm_constant_pool.h | |
parent | 8ab56869a64fdccc094f4a83c6367fb23b72d38b (diff) |
Sync to prism rename commits
Diffstat (limited to 'prism/util/pm_constant_pool.h')
-rw-r--r-- | prism/util/pm_constant_pool.h | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/prism/util/pm_constant_pool.h b/prism/util/pm_constant_pool.h index c07cd0b7d8..e320129d15 100644 --- a/prism/util/pm_constant_pool.h +++ b/prism/util/pm_constant_pool.h @@ -3,10 +3,10 @@ // equality. This comparison ends up being much faster than strcmp, since it // only requires a single integer comparison. -#ifndef YP_CONSTANT_POOL_H -#define YP_CONSTANT_POOL_H +#ifndef PRISM_CONSTANT_POOL_H +#define PRISM_CONSTANT_POOL_H -#include "yarp/defines.h" +#include "prism/defines.h" #include <assert.h> #include <stdbool.h> @@ -14,30 +14,30 @@ #include <stdlib.h> #include <string.h> -typedef uint32_t yp_constant_id_t; +typedef uint32_t pm_constant_id_t; typedef struct { - yp_constant_id_t *ids; + pm_constant_id_t *ids; size_t size; size_t capacity; -} yp_constant_id_list_t; +} pm_constant_id_list_t; // Initialize a list of constant ids. -void yp_constant_id_list_init(yp_constant_id_list_t *list); +void pm_constant_id_list_init(pm_constant_id_list_t *list); // Append a constant id to a list of constant ids. Returns false if any // potential reallocations fail. -bool yp_constant_id_list_append(yp_constant_id_list_t *list, yp_constant_id_t id); +bool pm_constant_id_list_append(pm_constant_id_list_t *list, pm_constant_id_t id); // Checks if the current constant id list includes the given constant id. bool -yp_constant_id_list_includes(yp_constant_id_list_t *list, yp_constant_id_t id); +pm_constant_id_list_includes(pm_constant_id_list_t *list, pm_constant_id_t id); // Get the memory size of a list of constant ids. -size_t yp_constant_id_list_memsize(yp_constant_id_list_t *list); +size_t pm_constant_id_list_memsize(pm_constant_id_list_t *list); // Free the memory associated with a list of constant ids. -void yp_constant_id_list_free(yp_constant_id_list_t *list); +void pm_constant_id_list_free(pm_constant_id_list_t *list); typedef struct { unsigned int id: 31; @@ -45,30 +45,30 @@ typedef struct { const uint8_t *start; size_t length; uint32_t hash; -} yp_constant_t; +} pm_constant_t; typedef struct { - yp_constant_t *constants; + pm_constant_t *constants; uint32_t size; uint32_t capacity; -} yp_constant_pool_t; +} pm_constant_pool_t; // Define an empty constant pool. -#define YP_CONSTANT_POOL_EMPTY ((yp_constant_pool_t) { .constants = NULL, .size = 0, .capacity = 0 }) +#define PM_CONSTANT_POOL_EMPTY ((pm_constant_pool_t) { .constants = NULL, .size = 0, .capacity = 0 }) // Initialize a new constant pool with a given capacity. -bool yp_constant_pool_init(yp_constant_pool_t *pool, uint32_t capacity); +bool pm_constant_pool_init(pm_constant_pool_t *pool, uint32_t capacity); // Insert a constant into a constant pool that is a slice of a source string. // Returns the id of the constant, or 0 if any potential calls to resize fail. -yp_constant_id_t yp_constant_pool_insert_shared(yp_constant_pool_t *pool, const uint8_t *start, size_t length); +pm_constant_id_t pm_constant_pool_insert_shared(pm_constant_pool_t *pool, const uint8_t *start, size_t length); // Insert a constant into a constant pool from memory that is now owned by the // constant pool. Returns the id of the constant, or 0 if any potential calls to // resize fail. -yp_constant_id_t yp_constant_pool_insert_owned(yp_constant_pool_t *pool, const uint8_t *start, size_t length); +pm_constant_id_t pm_constant_pool_insert_owned(pm_constant_pool_t *pool, const uint8_t *start, size_t length); // Free the memory associated with a constant pool. -void yp_constant_pool_free(yp_constant_pool_t *pool); +void pm_constant_pool_free(pm_constant_pool_t *pool); #endif |