Logo Search packages:      
Sourcecode: wireshark version File versions

char* convert_string_case ( const char *  string,
gboolean  case_insensitive 
)

Prep a string for case-sensitive vs case-insensitive searching.

Parameters:
string The search string
case_insensitive TRUE if case-insensitive, FALSE if not
Returns:
A direct copy of the string if it's a case-sensitive search and an uppercased version if not. In either case the string must be g_free()d by the caller.

Definition at line 942 of file strutil.c.

{
  char *out_string;
  const char *p;
  char c;
  char *q;

  if (case_insensitive) {
    out_string = g_malloc(strlen(string) + 1);
    for (p = &string[0], q = &out_string[0]; (c = *p) != '\0'; p++, q++)
      *q = toupper((unsigned char)*p);
    *q = '\0';
  } else
    out_string = g_strdup(string);
  return out_string;
}


Generated by  Doxygen 1.6.0   Back to index