Skip to content

Commit

Permalink
No more _HEX integer subtypes. They have been eliminated upstream also
Browse files Browse the repository at this point in the history
  • Loading branch information
attipaci committed Dec 10, 2024
1 parent 0d0fc6d commit 12eb938
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,14 @@ prior to invoking `make`. The following build variables can be configured:

- `CPPFLAGS`: C preprocessor flags, such as externally defined compiler constants.

- `CFLAGS`: Flags to pass onto the C compiler (default: `-Os -Wall -std=c99`). Note, `-Iinclude` will be added
- `CFLAGS`: Flags to pass onto the C compiler (default: `-g -Os -Wall`). Note, `-Iinclude` will be added
automatically.

- `CSTANDARD`: Optionally, specify the C standard to compile for, e.g. `c99` to compile for the C99 standard. If
defined then `-std=$(CSTANDARD)` is added to `CFLAGS` automatically.

- `WEXTRA`: If set to 1, `-Wextra` is added to `CFLAGS` automatically.

- `LDFLAGS`: Extra linker flags (default: _not set_). Note, `-lm -pthread -lsmax -lredisx -lxchange -lpq -lpopt` will
be added automatically.

Expand Down
11 changes: 9 additions & 2 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,17 @@ CPPFLAGS += -I$(INC)
#CPPFLAGS += -DTIMESCALEDB_OLD=1

# Base compiler options (if not defined externally...)
CFLAGS ?= -g -Os -Wall -std=c99
CFLAGS ?= -g -Os -Wall

# Compile for specific C standard
ifdef CSTANDARD
CFLAGS += -std=$(CSTANDARD)
endif

# Extra warnings (not supported on all compilers)
#CFLAGS += -Wextra
ifeq ($(WEXTRA), 1)
CFLAGS += -Wextra
endif

# Link against math libs (for e.g. isnan())
LDFLAGS ?= -lm
Expand Down
16 changes: 4 additions & 12 deletions src/postgres-backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,16 +500,12 @@ static int printSQLType(XType type, char *dst) {
case X_BOOLEAN:
return sprintf(dst, SQL_BOOLEAN);
case X_BYTE:
case X_BYTE_HEX:
return sprintf(dst, SQL_INT8);
case X_SHORT:
case X_SHORT_HEX:
return sprintf(dst, SQL_INT16);
case X_INT:
case X_INT_HEX:
return sprintf(dst, SQL_INT32);
case X_LONG:
case X_LONG_HEX:
return sprintf(dst, SQL_INT64);
case X_FLOAT:
return sprintf(dst, SQL_FLOAT);
Expand Down Expand Up @@ -611,17 +607,13 @@ static char *appendValue(const void *data, XType type, char *dst) {

case X_BOOLEAN: return dst + sprintf(dst, "%s",*(boolean *) data ? "true" : "false");

case X_BYTE:
case X_BYTE_HEX: return dst + sprintf(dst, "%hhd", *(char *) data);
case X_BYTE: return dst + sprintf(dst, "%hhd", *(char *) data);

case X_SHORT:
case X_SHORT_HEX: return dst + sprintf(dst, "%hd", *(int16_t *) data);
case X_SHORT: return dst + sprintf(dst, "%hd", *(int16_t *) data);

case X_INT:
case X_INT_HEX: return dst + sprintf(dst, "%d", *(int32_t *) data);
case X_INT: return dst + sprintf(dst, "%d", *(int32_t *) data);

case X_LONG:
case X_LONG_HEX: return dst + sprintf(dst, "%ld", *(int64_t *) data);
case X_LONG: return dst + sprintf(dst, "%ld", *(int64_t *) data);

case X_FLOAT: {
float f = *(float *) data;
Expand Down

0 comments on commit 12eb938

Please sign in to comment.