PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
pgstrcasecmp.c File Reference
#include "c.h"
#include <ctype.h>
Include dependency graph for pgstrcasecmp.c:

Go to the source code of this file.

Functions

int pg_strcasecmp (const char *s1, const char *s2)
 
int pg_strncasecmp (const char *s1, const char *s2, size_t n)
 
unsigned char pg_toupper (unsigned char ch)
 
unsigned char pg_tolower (unsigned char ch)
 
unsigned char pg_ascii_toupper (unsigned char ch)
 
unsigned char pg_ascii_tolower (unsigned char ch)
 

Function Documentation

unsigned char pg_ascii_tolower ( unsigned char  ch)

Definition at line 146 of file pgstrcasecmp.c.

Referenced by asc_initcap(), asc_tolower(), pg_wc_tolower(), and SB_lower_char().

147 {
148  if (ch >= 'A' && ch <= 'Z')
149  ch += 'a' - 'A';
150  return ch;
151 }
unsigned char pg_ascii_toupper ( unsigned char  ch)

Definition at line 135 of file pgstrcasecmp.c.

Referenced by asc_initcap(), asc_toupper(), filter_list_to_array(), and pg_wc_toupper().

136 {
137  if (ch >= 'a' && ch <= 'z')
138  ch += 'A' - 'a';
139  return ch;
140 }
int pg_strcasecmp ( const char *  s1,
const char *  s2 
)

Definition at line 36 of file pgstrcasecmp.c.

References IS_HIGHBIT_SET.

Referenced by AlterOperator(), AlterTSDictionary(), array_out(), ATExecSetRelOptions(), ATExecSetStorage(), build_startup_packet(), check_datestyle(), check_ddl_tag(), check_ident_usermap(), check_log_destination(), check_table_rewrite_ddl_tag(), check_usermap(), check_wal_consistency_checking(), comp_keyword_case_hook(), compute_attributes_with_style(), config_enum_lookup_by_name(), convert_any_priv_string(), convert_priv_string(), defGetBoolean(), defGetTypeLength(), DefineAggregate(), DefineCollation(), DefineOperator(), DefineRange(), DefineTSConfiguration(), DefineTSDictionary(), DefineTSParser(), DefineTSTemplate(), DefineType(), DefineView(), dintdict_init(), dispell_init(), do_pset(), doCustom(), dsimple_init(), dsnowball_init(), dsynonym_init(), dumpFunc(), dxsyn_init(), echo_hidden_hook(), echo_hook(), equivalent_locale(), evaluateSleep(), exec_command(), fillRelOptions(), find_matching_ts_config(), findTTStatus(), get_progname(), helpSQL(), histcontrol_hook(), hostname_match(), interpretOidsOption(), locate_stem_module(), lookup_prop_name(), main(), makeAlterConfigCommand(), on_error_rollback_hook(), parse_hstore(), parse_slash_copy(), parseArchiveFormat(), parseNameAndArgTypes(), ParseVariableBool(), pg_fe_sendauth(), pg_find_encoding(), pg_get_functiondef(), pg_size_bytes(), pg_stat_get_progress_info(), pgp_get_cipher_code(), pgp_get_digest_code(), PGTYPEStimestamp_defmt_scan(), plperl_trigger_handler(), plpgsql_extra_checks_check_hook(), PLy_exec_trigger(), pqSetenvPoll(), process_backslash_command(), prsd_headline(), px_find_digest(), px_gen_salt(), px_resolve_alias(), ReadArrayStr(), show_context_hook(), splitTzLine(), SyncRepGetStandbyPriority(), thesaurus_init(), transformCreateStmt(), transformPartitionSpec(), transformRelOptions(), unaccent_init(), validate_exec(), validateWithCheckOption(), verbosity_hook(), verify_peer_name_matches_certificate_name(), wildcard_certificate_match(), and xmlpi().

37 {
38  for (;;)
39  {
40  unsigned char ch1 = (unsigned char) *s1++;
41  unsigned char ch2 = (unsigned char) *s2++;
42 
43  if (ch1 != ch2)
44  {
45  if (ch1 >= 'A' && ch1 <= 'Z')
46  ch1 += 'a' - 'A';
47  else if (IS_HIGHBIT_SET(ch1) && isupper(ch1))
48  ch1 = tolower(ch1);
49 
50  if (ch2 >= 'A' && ch2 <= 'Z')
51  ch2 += 'a' - 'A';
52  else if (IS_HIGHBIT_SET(ch2) && isupper(ch2))
53  ch2 = tolower(ch2);
54 
55  if (ch1 != ch2)
56  return (int) ch1 - (int) ch2;
57  }
58  if (ch1 == 0)
59  break;
60  }
61  return 0;
62 }
#define IS_HIGHBIT_SET(ch)
Definition: c.h:973
char * s1
char * s2
int pg_strncasecmp ( const char *  s1,
const char *  s2,
size_t  n 
)

Definition at line 69 of file pgstrcasecmp.c.

References IS_HIGHBIT_SET.

Referenced by AlterTableGetRelOptionsLockLevel(), check_datestyle(), check_ddl_tag(), check_special_value(), check_timezone(), command_no_begin(), do_pset(), equivalent_locale(), float4in(), float8in_internal(), helpSQL(), is_select_command(), MainLoop(), map_sql_identifier_to_xml_name(), numeric_in(), parse_bool_with_len(), parseRelOptions(), ParseTzFile(), ParseVariableBool(), range_parse(), scan_directory_ci(), set_unicode_line_style(), set_var_from_str(), SpecialTags(), and transformRelOptions().

70 {
71  while (n-- > 0)
72  {
73  unsigned char ch1 = (unsigned char) *s1++;
74  unsigned char ch2 = (unsigned char) *s2++;
75 
76  if (ch1 != ch2)
77  {
78  if (ch1 >= 'A' && ch1 <= 'Z')
79  ch1 += 'a' - 'A';
80  else if (IS_HIGHBIT_SET(ch1) && isupper(ch1))
81  ch1 = tolower(ch1);
82 
83  if (ch2 >= 'A' && ch2 <= 'Z')
84  ch2 += 'a' - 'A';
85  else if (IS_HIGHBIT_SET(ch2) && isupper(ch2))
86  ch2 = tolower(ch2);
87 
88  if (ch1 != ch2)
89  return (int) ch1 - (int) ch2;
90  }
91  if (ch1 == 0)
92  break;
93  }
94  return 0;
95 }
#define IS_HIGHBIT_SET(ch)
Definition: c.h:973
char * s1
char * s2
unsigned char pg_tolower ( unsigned char  ch)

Definition at line 122 of file pgstrcasecmp.c.

References IS_HIGHBIT_SET.

Referenced by dir_strcmp(), ParseDateTime(), PGTYPESdate_defmt_asc(), PQfnumber(), processSQLNamePattern(), SB_lower_char(), seq_search(), str_initcap(), str_tolower(), and validateTzEntry().

123 {
124  if (ch >= 'A' && ch <= 'Z')
125  ch += 'a' - 'A';
126  else if (IS_HIGHBIT_SET(ch) && isupper(ch))
127  ch = tolower(ch);
128  return ch;
129 }
#define IS_HIGHBIT_SET(ch)
Definition: c.h:973
unsigned char pg_toupper ( unsigned char  ch)

Definition at line 105 of file pgstrcasecmp.c.

References IS_HIGHBIT_SET.

Referenced by cash_words(), DetermineTimeZoneAbbrevOffsetInternal(), pg_timezone_abbrevs(), pg_tzset(), seq_search(), str_initcap(), and str_toupper().

106 {
107  if (ch >= 'a' && ch <= 'z')
108  ch += 'A' - 'a';
109  else if (IS_HIGHBIT_SET(ch) && islower(ch))
110  ch = toupper(ch);
111  return ch;
112 }
#define IS_HIGHBIT_SET(ch)
Definition: c.h:973