make-relptr-allow-zero-address.patch
text/x-patch
Filename: make-relptr-allow-zero-address.patch
Type: text/x-patch
Part: 0
Patch
Format: unified
| File | + | − |
|---|---|---|
| src/include/utils/relptr.h | 5 | 5 |
diff --git a/src/include/utils/relptr.h b/src/include/utils/relptr.h
index cc80a7200d..c6d39a1360 100644
--- a/src/include/utils/relptr.h
+++ b/src/include/utils/relptr.h
@@ -41,7 +41,7 @@
#ifdef HAVE__BUILTIN_TYPES_COMPATIBLE_P
#define relptr_access(base, rp) \
(AssertVariableIsOfTypeMacro(base, char *), \
- (__typeof__((rp).relptr_type)) ((rp).relptr_off == 0 ? NULL : \
+ (__typeof__((rp).relptr_type)) ((rp).relptr_off == ((Size) -1) ? NULL : \
(base + (rp).relptr_off)))
#else
/*
@@ -50,21 +50,21 @@
*/
#define relptr_access(base, rp) \
(AssertVariableIsOfTypeMacro(base, char *), \
- (void *) ((rp).relptr_off == 0 ? NULL : (base + (rp).relptr_off)))
+ (void *) ((rp).relptr_off == ((Size) -1) ? NULL : (base + (rp).relptr_off)))
#endif
#define relptr_is_null(rp) \
- ((rp).relptr_off == 0)
+ ((rp).relptr_off == ((Size) -1))
/* We use this inline to avoid double eval of "val" in relptr_store */
static inline Size
relptr_store_eval(char *base, char *val)
{
if (val == NULL)
- return 0;
+ return ((Size) -1);
else
{
- Assert(val > base);
+ Assert(val >= base);
return val - base;
}
}