PostgreSQL Source Code  git master
string.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool pg_str_endswith (const char *str, const char *end)
 
int strtoint (const char *pg_restrict str, char **pg_restrict endptr, int base)
 

Function Documentation

◆ pg_str_endswith()

bool pg_str_endswith ( const char *  str,
const char *  end 
)

Definition at line 31 of file string.c.

Referenced by process_source_file(), ReceiveAndUnpackTarFile(), and StartupReplicationSlots().

32 {
33  size_t slen = strlen(str);
34  size_t elen = strlen(end);
35 
36  /* can't be a postfix if longer */
37  if (elen > slen)
38  return false;
39 
40  /* compare the end of the strings */
41  str += slen - elen;
42  return strcmp(str, end) == 0;
43 }

◆ strtoint()

int strtoint ( const char *pg_restrict  str,
char **pg_restrict  endptr,
int  base 
)

Definition at line 50 of file string.c.

References val.

Referenced by DecodeDateTime(), DecodeInterval(), DecodeNumber(), DecodeTime(), DecodeTimeOnly(), DecodeTimezone(), and nodeTokenType().

51 {
52  long val;
53 
54  val = strtol(str, endptr, base);
55  if (val != (int) val)
56  errno = ERANGE;
57  return (int) val;
58 }
long val
Definition: informix.c:689