PostgreSQL Source Code  git master
string.c File Reference
#include "postgres.h"
#include "common/string.h"
Include dependency graph for string.c:

Go to the source code of this file.

Functions

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

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 }