PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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)
 

Function Documentation

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 }