mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Make sure contrib C functions are marked strict where needed.
Kris Jurka
This commit is contained in:
@ -30,12 +30,9 @@
|
||||
|
||||
#include "misc_utils.h"
|
||||
|
||||
#undef MIN
|
||||
#define MIN(x,y) ((x)<=(y) ? (x) : (y))
|
||||
|
||||
|
||||
int
|
||||
backend_pid()
|
||||
backend_pid(void)
|
||||
{
|
||||
return getpid();
|
||||
}
|
||||
@ -48,15 +45,15 @@ unlisten(char *relname)
|
||||
}
|
||||
|
||||
int
|
||||
max(int x, int y)
|
||||
int4max(int x, int y)
|
||||
{
|
||||
return ((x > y) ? x : y);
|
||||
return Max(x, y);
|
||||
}
|
||||
|
||||
int
|
||||
min(int x, int y)
|
||||
int4min(int x, int y)
|
||||
{
|
||||
return ((x < y) ? x : y);
|
||||
return Min(x, y);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -84,7 +81,7 @@ active_listeners(text *relname)
|
||||
if (relname && (VARSIZE(relname) > VARHDRSZ))
|
||||
{
|
||||
MemSet(listen_name, 0, NAMEDATALEN);
|
||||
len = MIN(VARSIZE(relname) - VARHDRSZ, NAMEDATALEN - 1);
|
||||
len = Min(VARSIZE(relname) - VARHDRSZ, NAMEDATALEN - 1);
|
||||
memcpy(listen_name, VARDATA(relname), len);
|
||||
ScanKeyEntryInitialize(&key, 0,
|
||||
Anum_pg_listener_relname,
|
||||
@ -99,7 +96,7 @@ active_listeners(text *relname)
|
||||
{
|
||||
d = heap_getattr(lTuple, Anum_pg_listener_pid, tdesc, &isnull);
|
||||
pid = DatumGetInt32(d);
|
||||
if ((pid == ourpid) || (kill(pid, SIGTSTP) == 0))
|
||||
if ((pid == ourpid) || (kill(pid, 0) == 0))
|
||||
count++;
|
||||
}
|
||||
heap_endscan(sRel);
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
int backend_pid(void);
|
||||
int unlisten(char *relname);
|
||||
int max(int x, int y);
|
||||
int min(int x, int y);
|
||||
int int4max(int x, int y);
|
||||
int int4min(int x, int y);
|
||||
int active_listeners(text *relname);
|
||||
|
||||
#endif
|
||||
|
@ -36,15 +36,15 @@ LANGUAGE 'SQL';
|
||||
--
|
||||
CREATE OR REPLACE FUNCTION min(int4,int4)
|
||||
RETURNS int4
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE 'C';
|
||||
AS 'MODULE_PATHNAME', 'int4min'
|
||||
LANGUAGE 'C' STRICT;
|
||||
|
||||
-- max(x,y)
|
||||
--
|
||||
CREATE OR REPLACE FUNCTION max(int4,int4)
|
||||
RETURNS int4
|
||||
AS 'MODULE_PATHNAME'
|
||||
LANGUAGE 'C';
|
||||
AS 'MODULE_PATHNAME', 'int4max'
|
||||
LANGUAGE 'C' STRICT;
|
||||
|
||||
-- Return the number of active listeners on a relation
|
||||
--
|
||||
|
Reference in New Issue
Block a user