Skip to content

Commit b42c1ec

Browse files
author
Nikita Glukhov
committed
TMP: Fix warnings
1 parent 9083688 commit b42c1ec

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed

contrib/jsonb_toaster/jsonb_toast_internals.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,7 @@ jsonx_toast_delete_datum(Datum value, bool is_speculative)
900900
table_close(toastrel, NoLock);
901901
}
902902

903+
#if 0
903904
static void
904905
jsonx_process_toast_chunk(Relation toastrel, Oid valueid, struct varlena *result,
905906
int chunk_data_size, int attrsize, int chunksize,
@@ -953,6 +954,7 @@ jsonx_process_toast_chunk(Relation toastrel, Oid valueid, struct varlena *result
953954
chunkdata + chcpystrt,
954955
(chcpyend - chcpystrt) + 1);
955956
}
957+
#endif
956958

957959
static void
958960
jsonx_create_fetch_datum_iterator_scan(JsonxFetchDatumIterator iter, int32 first_chunkno)

contrib/jsonb_toaster/jsonb_toaster.c

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2914,6 +2914,9 @@ jsonb_toaster_save_object(Relation rel, Oid toasterid, JsonContainer *root,
29142914
JsonContainer *jc;
29152915
JsonbContainerHeader *jbc;
29162916

2917+
Datum value_to_toast;
2918+
bool compress_chunks;
2919+
29172920
for (i = 0; i < nkeys; i++)
29182921
{
29192922
if (pairs[i].value.type == jbvBinary &&
@@ -3045,9 +3048,6 @@ jsonb_toaster_save_object(Relation rel, Oid toasterid, JsonContainer *root,
30453048
if (!jsonb_toast_fields)
30463049
goto exit;
30473050

3048-
Datum value_to_toast;
3049-
bool compress_chunks;
3050-
30513051
if (jsonb_compress_chunks && orig_val)
30523052
{
30533053
compress_chunks = true;
@@ -3108,8 +3108,8 @@ jsonb_toaster_save_object(Relation rel, Oid toasterid, JsonContainer *root,
31083108

31093109
//Assert(VARSIZE_ANY(toasted_val) == TOAST_POINTER_SIZE);
31103110

3111-
fields[max_key_idx].orig_value = (Datum) 0;
3112-
fields[max_key_idx].value = (Datum) 0;
3111+
fields[max_key_idx].orig_value = NULL;
3112+
fields[max_key_idx].value = NULL;
31133113
fields[max_key_idx].size = offsetof(JsonbToastedContainerPointer, data) + VARSIZE_ANY(toasted_val); //TOAST_POINTER_SIZE;
31143114
fields[max_key_idx].status = 't';
31153115
pairs[max_key_idx].value.val.binary.data = jsonxzInitContainerFromDatum(jc, toasted_val);
@@ -3652,7 +3652,7 @@ jsonb_toaster_default_toast(Relation rel, Oid toasterid, char cmethod,
36523652
NULL, options, NULL, NULL, false);
36533653
}
36543654

3655-
static struct varlena *
3655+
static Datum
36563656
jsonb_toaster_toast(Relation rel, Oid toasterid,
36573657
Datum new_val, Datum old_val,
36583658
int max_inline_size, int options)
@@ -3678,10 +3678,10 @@ jsonb_toaster_toast(Relation rel, Oid toasterid,
36783678

36793679
jsonbFreeIterators();
36803680

3681-
return (struct varlena *) DatumGetPointer(res);
3681+
return res;
36823682
}
36833683

3684-
static struct varlena *
3684+
static Datum
36853685
jsonb_toaster_update_toast(Relation rel, Oid toasterid,
36863686
Datum new_val, Datum old_val,
36873687
int options)
@@ -3699,10 +3699,10 @@ jsonb_toaster_update_toast(Relation rel, Oid toasterid,
36993699

37003700
jsonbFreeIterators();
37013701

3702-
return (struct varlena *) DatumGetPointer(res);
3702+
return res;
37033703
}
37043704

3705-
static struct varlena *
3705+
static Datum
37063706
jsonb_toaster_copy_toast(Relation rel, Oid toasterid,
37073707
Datum new_val, int options)
37083708
{
@@ -3717,7 +3717,7 @@ jsonb_toaster_copy_toast(Relation rel, Oid toasterid,
37173717

37183718
jsonbFreeIterators();
37193719

3720-
return (struct varlena *) DatumGetPointer(res);
3720+
return res;
37213721
}
37223722

37233723
static void
@@ -3733,11 +3733,11 @@ jsonb_toaster_delete_toast(Datum val, bool is_speculative)
37333733
jsonbFreeIterators();
37343734
}
37353735

3736-
static struct varlena *
3736+
static Datum
37373737
jsonb_toaster_detoast(Datum toastptr, int sliceoffset, int slicelength)
37383738
{
37393739
struct varlena *result;
3740-
Json jsbuf;
3740+
//Json jsbuf;
37413741
Json *js;
37423742
JsonValue bin;
37433743
void *detoasted;
@@ -3758,7 +3758,7 @@ jsonb_toaster_detoast(Datum toastptr, int sliceoffset, int slicelength)
37583758
jsonbFreeIterators();
37593759

37603760
if (sliceoffset == 0 && (slicelength < 0 || slicelength >= len))
3761-
return detoasted;
3761+
return PointerGetDatum(detoasted);
37623762

37633763
if (sliceoffset < 0)
37643764
sliceoffset = 0;
@@ -3774,7 +3774,7 @@ jsonb_toaster_detoast(Datum toastptr, int sliceoffset, int slicelength)
37743774

37753775
pfree(detoasted);
37763776

3777-
return result;
3777+
return PointerGetDatum(result);
37783778
}
37793779

37803780
static void *
@@ -3789,10 +3789,11 @@ jsonb_toaster_vtable(Datum toast_ptr)
37893789
}
37903790

37913791
static void
3792-
jsonb_toaster_init(Relation rel, Datum reloptions, LOCKMODE lockmode,
3792+
jsonb_toaster_init(Relation rel, Oid toastoid, Oid toastindexoid,
3793+
Datum reloptions, LOCKMODE lockmode,
37933794
bool check, Oid OIDOldToast)
37943795
{
3795-
(void) create_toast_table(rel, InvalidOid, InvalidOid, reloptions,
3796+
(void) create_toast_table(rel, toastoid, toastindexoid, reloptions,
37963797
lockmode, check, OIDOldToast);
37973798
}
37983799

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy