formatting-shave-bits.patch
text/x-diff
Filename: formatting-shave-bits.patch
Type: text/x-diff
Part: 0
Message:
Re: Large writable variables
Patch
Format: unified
| File | + | − |
|---|---|---|
| src/backend/utils/adt/formatting.c | 0 | 0 |
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index b3ff133..9c2649e 100644
*** a/src/backend/utils/adt/formatting.c
--- b/src/backend/utils/adt/formatting.c
***************
*** 124,133 ****
*/
typedef struct
{
! char *name; /* suffix string */
int len, /* suffix length */
id, /* used in node->suffix */
! type; /* prefix / postfix */
} KeySuffix;
/* ----------
--- 124,133 ----
*/
typedef struct
{
! const char *name; /* suffix string */
int len, /* suffix length */
id, /* used in node->suffix */
! type; /* prefix / postfix */
} KeySuffix;
/* ----------
*************** typedef struct
*** 155,164 ****
typedef struct
{
! int type; /* NODE_TYPE_XXX, see below */
! const KeyWord *key; /* if type is ACTION */
char character[MAX_MULTIBYTE_CHAR_LEN + 1]; /* if type is CHAR */
! int suffix; /* keyword prefix/suffix code, if any */
} FormatNode;
#define NODE_TYPE_END 1
--- 155,164 ----
typedef struct
{
! uint8 type; /* NODE_TYPE_XXX, see below */
char character[MAX_MULTIBYTE_CHAR_LEN + 1]; /* if type is CHAR */
! uint8 suffix; /* keyword prefix/suffix code, if any */
! const KeyWord *key; /* if type is ACTION */
} FormatNode;
#define NODE_TYPE_END 1
*************** typedef struct
*** 358,370 ****
* For simplicity, the cache entries are fixed-size, so they allow for the
* worst case of a FormatNode for each byte in the picture string.
*
* The max number of entries in the caches is DCH_CACHE_ENTRIES
* resp. NUM_CACHE_ENTRIES.
* ----------
*/
! #define NUM_CACHE_SIZE 64
#define NUM_CACHE_ENTRIES 20
! #define DCH_CACHE_SIZE 128
#define DCH_CACHE_ENTRIES 20
typedef struct
--- 358,374 ----
* For simplicity, the cache entries are fixed-size, so they allow for the
* worst case of a FormatNode for each byte in the picture string.
*
+ * The CACHE_SIZE constants are chosen to make sizeof(DCHCacheEntry) and
+ * sizeof(NUMCacheEntry) be powers of 2, or just less than that, so that
+ * we don't waste too much space by palloc'ing them individually.
+ *
* The max number of entries in the caches is DCH_CACHE_ENTRIES
* resp. NUM_CACHE_ENTRIES.
* ----------
*/
! #define NUM_CACHE_SIZE 56
#define NUM_CACHE_ENTRIES 20
! #define DCH_CACHE_SIZE 119
#define DCH_CACHE_ENTRIES 20
typedef struct
*************** do { \
*** 496,502 ****
*****************************************************************************/
/* ----------
! * Suffixes:
* ----------
*/
#define DCH_S_FM 0x01
--- 500,506 ----
*****************************************************************************/
/* ----------
! * Suffixes (FormatNode.suffix is an OR of these codes)
* ----------
*/
#define DCH_S_FM 0x01