Header And Logo

PostgreSQL
| The world's most advanced open source database.

Functions

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().

{
    if (ch >= 'A' && ch <= 'Z')
        ch += 'a' - 'A';
    return ch;
}

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().

{
    if (ch >= 'a' && ch <= 'z')
        ch += 'A' - 'a';
    return ch;
}

int pg_strcasecmp ( const char *  s1,
const char *  s2 
)

Definition at line 36 of file pgstrcasecmp.c.

References IS_HIGHBIT_SET.

Referenced by AlterTSDictionary(), array_out(), ATExecSetStorage(), build_startup_packet(), check_datestyle(), check_ddl_tag(), check_ident_usermap(), check_locale_and_encoding(), check_log_destination(), check_usermap(), compat_find_digest(), 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(), dintdict_init(), dispell_init(), do_pset(), doCustom(), dsimple_init(), dsnowball_init(), dsynonym_init(), dumpFunc(), dxsyn_init(), echo_hidden_hook(), exec_command(), fillRelOptions(), find_matching_ts_config(), findTTStatus(), get_progname(), helpSQL(), hostname_match(), interpretOidsOption(), locate_stem_module(), main(), makeAlterConfigCommand(), on_error_rollback_hook(), parse_hstore(), parse_slash_copy(), parseArchiveFormat(), parseNameAndArgTypes(), ParseVariableBool(), pg_bind_textdomain_codeset(), pg_fe_sendauth(), pg_find_encoding(), pg_get_functiondef(), pgp_get_cipher_code(), pgp_get_digest_code(), PGTYPEStimestamp_defmt_scan(), plperl_trigger_handler(), PLy_exec_trigger(), pqSetenvPoll(), process_commands(), prsd_headline(), px_find_digest(), px_gen_salt(), px_resolve_alias(), ReadArrayStr(), splitTzLine(), SyncRepGetStandbyPriority(), thesaurus_init(), transformRelOptions(), unaccent_init(), validate_exec(), and xmlpi().

{
    for (;;)
    {
        unsigned char ch1 = (unsigned char) *s1++;
        unsigned char ch2 = (unsigned char) *s2++;

        if (ch1 != ch2)
        {
            if (ch1 >= 'A' && ch1 <= 'Z')
                ch1 += 'a' - 'A';
            else if (IS_HIGHBIT_SET(ch1) && isupper(ch1))
                ch1 = tolower(ch1);

            if (ch2 >= 'A' && ch2 <= 'Z')
                ch2 += 'a' - 'A';
            else if (IS_HIGHBIT_SET(ch2) && isupper(ch2))
                ch2 = tolower(ch2);

            if (ch1 != ch2)
                return (int) ch1 - (int) ch2;
        }
        if (ch1 == 0)
            break;
    }
    return 0;
}

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 check_datestyle(), check_ddl_tag(), check_special_value(), check_timezone(), command_no_begin(), do_pset(), float4in(), float8in(), 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_var_from_str(), SpecialTags(), and transformRelOptions().

{
    while (n-- > 0)
    {
        unsigned char ch1 = (unsigned char) *s1++;
        unsigned char ch2 = (unsigned char) *s2++;

        if (ch1 != ch2)
        {
            if (ch1 >= 'A' && ch1 <= 'Z')
                ch1 += 'a' - 'A';
            else if (IS_HIGHBIT_SET(ch1) && isupper(ch1))
                ch1 = tolower(ch1);

            if (ch2 >= 'A' && ch2 <= 'Z')
                ch2 += 'a' - 'A';
            else if (IS_HIGHBIT_SET(ch2) && isupper(ch2))
                ch2 = tolower(ch2);

            if (ch1 != ch2)
                return (int) ch1 - (int) ch2;
        }
        if (ch1 == 0)
            break;
    }
    return 0;
}

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().

{
    if (ch >= 'A' && ch <= 'Z')
        ch += 'a' - 'A';
    else if (IS_HIGHBIT_SET(ch) && isupper(ch))
        ch = tolower(ch);
    return ch;
}

unsigned char pg_toupper ( unsigned char  ch  ) 

Definition at line 105 of file pgstrcasecmp.c.

References IS_HIGHBIT_SET.

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

{
    if (ch >= 'a' && ch <= 'z')
        ch += 'A' - 'a';
    else if (IS_HIGHBIT_SET(ch) && islower(ch))
        ch = toupper(ch);
    return ch;
}