Remove a number of redundant fns in Engine.Util.Ascii.
* src/engine/util/util-ascii.vala (Geary.Ascii): Remove functions that are now supported by Vala 0.26, that are simple statements, or are only used once elsewhere. Update call sites.
This commit is contained in:
parent
f4f775c8c2
commit
1d8c4aea80
13 changed files with 92 additions and 129 deletions
|
|
@ -23,10 +23,10 @@ public enum Quoting {
|
||||||
private bool is_special_char(char ch, char[] ar, string? exceptions) {
|
private bool is_special_char(char ch, char[] ar, string? exceptions) {
|
||||||
if (ch > 0x7F || ch.iscntrl())
|
if (ch > 0x7F || ch.iscntrl())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (ch in ar)
|
if (ch in ar)
|
||||||
return (exceptions != null) ? Ascii.index_of(exceptions, ch) < 0 : true;
|
return (exceptions != null) ? exceptions.index_of_char(ch) < 0 : true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,15 +73,15 @@ public class Geary.Imap.FetchBodyDataSpecifier : BaseObject, Gee.Hashable<FetchB
|
||||||
assert_not_reached();
|
assert_not_reached();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SectionPart deserialize(string value) throws ImapError {
|
public static SectionPart deserialize(string value) throws ImapError {
|
||||||
if (String.is_empty(value))
|
if (String.is_empty(value))
|
||||||
return NONE;
|
return NONE;
|
||||||
|
|
||||||
switch (Ascii.strdown(value)) {
|
switch (value.down()) {
|
||||||
case "header":
|
case "header":
|
||||||
return HEADER;
|
return HEADER;
|
||||||
|
|
||||||
case "header.fields":
|
case "header.fields":
|
||||||
return HEADER_FIELDS;
|
return HEADER_FIELDS;
|
||||||
|
|
||||||
|
|
@ -178,23 +178,25 @@ public class Geary.Imap.FetchBodyDataSpecifier : BaseObject, Gee.Hashable<FetchB
|
||||||
this.subset_start = subset_start;
|
this.subset_start = subset_start;
|
||||||
this.subset_count = subset_count;
|
this.subset_count = subset_count;
|
||||||
this.is_peek = is_peek;
|
this.is_peek = is_peek;
|
||||||
|
|
||||||
if (field_names != null && field_names.length > 0) {
|
if (field_names != null && field_names.length > 0) {
|
||||||
this.field_names = new Gee.TreeSet<string>(Ascii.strcmp);
|
this.field_names = new Gee.TreeSet<string>((s1, s2) => {
|
||||||
|
return GLib.strcmp(s1, s2);
|
||||||
|
});
|
||||||
foreach (string field_name in field_names) {
|
foreach (string field_name in field_names) {
|
||||||
string converted = Ascii.strdown(field_name.strip());
|
string converted = field_name.strip().down();
|
||||||
|
|
||||||
if (!String.is_empty(converted))
|
if (!String.is_empty(converted))
|
||||||
this.field_names.add(converted);
|
this.field_names.add(converted);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.field_names = null;
|
this.field_names = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// see equal_to() for why the response version is used
|
// see equal_to() for why the response version is used
|
||||||
hashable = serialize_response();
|
hashable = serialize_response();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link FetchBodyDataSpecifier} in a string ready for a {@link Command}.
|
* Returns the {@link FetchBodyDataSpecifier} in a string ready for a {@link Command}.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -67,18 +67,18 @@ public class Geary.Imap.InternalDate : Geary.MessageData.AbstractMessageData, Ge
|
||||||
|| year < 1970) {
|
|| year < 1970) {
|
||||||
throw new ImapError.PARSE_ERROR("Invalid INTERNALDATE \"%s\": bad numerical range", internaldate);
|
throw new ImapError.PARSE_ERROR("Invalid INTERNALDATE \"%s\": bad numerical range", internaldate);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check month (this catches localization problems)
|
// check month (this catches localization problems)
|
||||||
int month = -1;
|
int month = -1;
|
||||||
string mon_down = Ascii.strdown(((string) mon));
|
string mon_down = ((string) mon).down();
|
||||||
for (int ctr = 0; ctr < EN_US_MON_DOWN.length; ctr++) {
|
for (int ctr = 0; ctr < EN_US_MON_DOWN.length; ctr++) {
|
||||||
if (mon_down == EN_US_MON_DOWN[ctr]) {
|
if (mon_down == EN_US_MON_DOWN[ctr]) {
|
||||||
month = ctr;
|
month = ctr;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (month < 0)
|
if (month < 0)
|
||||||
throw new ImapError.PARSE_ERROR("Invalid INTERNALDATE \"%s\": bad month", internaldate);
|
throw new ImapError.PARSE_ERROR("Invalid INTERNALDATE \"%s\": bad month", internaldate);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ public class Geary.Imap.MailboxSpecifier : BaseObject, Gee.Hashable<MailboxSpeci
|
||||||
public static bool is_inbox_name(string name) {
|
public static bool is_inbox_name(string name) {
|
||||||
return Ascii.stri_equal(name, CANONICAL_INBOX_NAME);
|
return Ascii.stri_equal(name, CANONICAL_INBOX_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the string is the ''canonical'' name of the IMAP Inbox.
|
* Returns true if the string is the ''canonical'' name of the IMAP Inbox.
|
||||||
*
|
*
|
||||||
|
|
@ -85,9 +85,9 @@ public class Geary.Imap.MailboxSpecifier : BaseObject, Gee.Hashable<MailboxSpeci
|
||||||
* @see is_inbox_name
|
* @see is_inbox_name
|
||||||
*/
|
*/
|
||||||
public static bool is_canonical_inbox_name(string name) {
|
public static bool is_canonical_inbox_name(string name) {
|
||||||
return Ascii.str_equal(name, CANONICAL_INBOX_NAME);
|
return (name == CANONICAL_INBOX_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a generic {@link FolderPath} into an IMAP mailbox specifier.
|
* Converts a generic {@link FolderPath} into an IMAP mailbox specifier.
|
||||||
*/
|
*/
|
||||||
|
|
@ -175,27 +175,27 @@ public class Geary.Imap.MailboxSpecifier : BaseObject, Gee.Hashable<MailboxSpeci
|
||||||
public uint hash() {
|
public uint hash() {
|
||||||
return is_inbox ? Ascii.stri_hash(name) : Ascii.str_hash(name);
|
return is_inbox ? Ascii.stri_hash(name) : Ascii.str_hash(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool equal_to(MailboxSpecifier other) {
|
public bool equal_to(MailboxSpecifier other) {
|
||||||
if (this == other)
|
if (this == other)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (is_inbox)
|
if (is_inbox)
|
||||||
return Ascii.stri_equal(name, other.name);
|
return Ascii.stri_equal(name, other.name);
|
||||||
|
|
||||||
return Ascii.str_equal(name, other.name);
|
return (name == other.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int compare_to(MailboxSpecifier other) {
|
public int compare_to(MailboxSpecifier other) {
|
||||||
if (this == other)
|
if (this == other)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (is_inbox && other.is_inbox)
|
if (is_inbox && other.is_inbox)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return Ascii.strcmp(name, other.name);
|
return GLib.strcmp(name, other.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string to_string() {
|
public string to_string() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -134,35 +134,35 @@ public abstract class Geary.Imap.StringParameter : Geary.Imap.Parameter {
|
||||||
public bool is_empty() {
|
public bool is_empty() {
|
||||||
return String.is_empty(ascii);
|
return String.is_empty(ascii);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Case-sensitive comparison.
|
* Case-sensitive comparison.
|
||||||
*/
|
*/
|
||||||
public bool equals_cs(string value) {
|
public bool equals_cs(string value) {
|
||||||
return Ascii.str_equal(ascii, value);
|
return (ascii == value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Case-insensitive comparison.
|
* Case-insensitive comparison.
|
||||||
*/
|
*/
|
||||||
public bool equals_ci(string value) {
|
public bool equals_ci(string value) {
|
||||||
return Ascii.stri_equal(ascii, value);
|
return Ascii.stri_equal(ascii, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the string lowercased.
|
* Returns the string lowercased.
|
||||||
*/
|
*/
|
||||||
public string as_lower() {
|
public string as_lower() {
|
||||||
return Ascii.strdown(ascii);
|
return ascii.down();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the string uppercased.
|
* Returns the string uppercased.
|
||||||
*/
|
*/
|
||||||
public string as_upper() {
|
public string as_upper() {
|
||||||
return Ascii.strup(ascii);
|
return ascii.up();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts the {@link ascii} to a signed 32-bit integer, clamped between clamp_min and
|
* Converts the {@link ascii} to a signed 32-bit integer, clamped between clamp_min and
|
||||||
* clamp_max.
|
* clamp_max.
|
||||||
|
|
|
||||||
|
|
@ -64,17 +64,17 @@ public class Geary.Imap.ResponseCodeType : BaseObject, Gee.Hashable<ResponseCode
|
||||||
public ResponseCodeType.from_parameter(StringParameter stringp) throws ImapError {
|
public ResponseCodeType.from_parameter(StringParameter stringp) throws ImapError {
|
||||||
init(stringp.ascii);
|
init(stringp.ascii);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init(string ascii) throws ImapError {
|
private void init(string ascii) throws ImapError {
|
||||||
// note that is_quoting_required() also catches empty strings (as they require quoting)
|
// note that is_quoting_required() also catches empty strings (as they require quoting)
|
||||||
if (DataFormat.is_quoting_required(ascii) != DataFormat.Quoting.OPTIONAL)
|
if (DataFormat.is_quoting_required(ascii) != DataFormat.Quoting.OPTIONAL)
|
||||||
throw new ImapError.INVALID("\"%s\" cannot be represented as a ResponseCodeType", ascii);
|
throw new ImapError.INVALID("\"%s\" cannot be represented as a ResponseCodeType", ascii);
|
||||||
|
|
||||||
// store lowercased so it's easily compared with const strings above
|
// store lowercased so it's easily compared with const strings above
|
||||||
original = ascii;
|
original = ascii;
|
||||||
value = Ascii.strdown(ascii);
|
value = ascii.down();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool is_value(string str) {
|
public bool is_value(string str) {
|
||||||
return Ascii.stri_equal(value, str);
|
return Ascii.stri_equal(value, str);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ public class Geary.Mime.ContentParameters : BaseObject {
|
||||||
|
|
||||||
return (stored != null) ? Ascii.stri_equal(stored, value) : false;
|
return (stored != null) ? Ascii.stri_equal(stored, value) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the attribute has the supplied value (case-sensitive comparison).
|
* Returns true if the attribute has the supplied value (case-sensitive comparison).
|
||||||
*
|
*
|
||||||
|
|
@ -86,10 +86,10 @@ public class Geary.Mime.ContentParameters : BaseObject {
|
||||||
*/
|
*/
|
||||||
public bool has_value_cs(string attribute, string value) {
|
public bool has_value_cs(string attribute, string value) {
|
||||||
string? stored = params.get(attribute);
|
string? stored = params.get(attribute);
|
||||||
|
|
||||||
return (stored != null) ? Ascii.str_equal(stored, value) : false;
|
return (stored != null) ? (stored == value) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add or replace the parameter.
|
* Add or replace the parameter.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -31,24 +31,24 @@ public enum Geary.Mime.DispositionType {
|
||||||
*/
|
*/
|
||||||
public static DispositionType deserialize(string? str, out bool is_unknown) {
|
public static DispositionType deserialize(string? str, out bool is_unknown) {
|
||||||
is_unknown = false;
|
is_unknown = false;
|
||||||
|
|
||||||
if (String.is_empty_or_whitespace(str))
|
if (String.is_empty_or_whitespace(str))
|
||||||
return UNSPECIFIED;
|
return UNSPECIFIED;
|
||||||
|
|
||||||
switch (Ascii.strdown(str)) {
|
switch (str.down()) {
|
||||||
case "inline":
|
case "inline":
|
||||||
return INLINE;
|
return INLINE;
|
||||||
|
|
||||||
case "attachment":
|
case "attachment":
|
||||||
return ATTACHMENT;
|
return ATTACHMENT;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
is_unknown = true;
|
is_unknown = true;
|
||||||
|
|
||||||
return ATTACHMENT;
|
return ATTACHMENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns null if value is {@link UNSPECIFIED}
|
* Returns null if value is {@link UNSPECIFIED}
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -48,24 +48,24 @@ public enum Geary.Mime.MultipartSubtype {
|
||||||
public static MultipartSubtype from_content_type(ContentType? content_type, out bool is_unknown) {
|
public static MultipartSubtype from_content_type(ContentType? content_type, out bool is_unknown) {
|
||||||
if (content_type == null || !content_type.has_media_type("multipart")) {
|
if (content_type == null || !content_type.has_media_type("multipart")) {
|
||||||
is_unknown = true;
|
is_unknown = true;
|
||||||
|
|
||||||
return MIXED;
|
return MIXED;
|
||||||
}
|
}
|
||||||
|
|
||||||
is_unknown = false;
|
is_unknown = false;
|
||||||
switch (Ascii.strdown(content_type.media_subtype)) {
|
switch (content_type.media_subtype.down()) {
|
||||||
case "mixed":
|
case "mixed":
|
||||||
return MIXED;
|
return MIXED;
|
||||||
|
|
||||||
case "alternative":
|
case "alternative":
|
||||||
return ALTERNATIVE;
|
return ALTERNATIVE;
|
||||||
|
|
||||||
case "related":
|
case "related":
|
||||||
return RELATED;
|
return RELATED;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
is_unknown = true;
|
is_unknown = true;
|
||||||
|
|
||||||
return MIXED;
|
return MIXED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,14 +46,14 @@ public class Geary.RFC822.MailboxAddress : Geary.MessageData.SearchableMessageDa
|
||||||
* For "Dirk Gently <dirk@example.com>", this would be "dirk@example.com".
|
* For "Dirk Gently <dirk@example.com>", this would be "dirk@example.com".
|
||||||
*/
|
*/
|
||||||
public string address { get; private set; }
|
public string address { get; private set; }
|
||||||
|
|
||||||
public MailboxAddress(string? name, string address) {
|
public MailboxAddress(string? name, string address) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.address = address;
|
this.address = address;
|
||||||
|
|
||||||
source_route = null;
|
source_route = null;
|
||||||
|
|
||||||
int atsign = Ascii.index_of(address, '@');
|
int atsign = address.index_of_char('@');
|
||||||
if (atsign > 0) {
|
if (atsign > 0) {
|
||||||
mailbox = address.slice(0, atsign);
|
mailbox = address.slice(0, atsign);
|
||||||
domain = address.slice(atsign + 1, address.length);
|
domain = address.slice(atsign + 1, address.length);
|
||||||
|
|
@ -62,7 +62,7 @@ public class Geary.RFC822.MailboxAddress : Geary.MessageData.SearchableMessageDa
|
||||||
domain = "";
|
domain = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MailboxAddress.imap(string? name, string? source_route, string mailbox, string domain) {
|
public MailboxAddress.imap(string? name, string? source_route, string mailbox, string domain) {
|
||||||
this.name = (name != null) ? decode_name(name) : null;
|
this.name = (name != null) ? decode_name(name) : null;
|
||||||
this.source_route = source_route;
|
this.source_route = source_route;
|
||||||
|
|
|
||||||
|
|
@ -56,36 +56,36 @@ public enum Geary.Smtp.Command {
|
||||||
assert_not_reached();
|
assert_not_reached();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Command deserialize(string str) throws SmtpError {
|
public static Command deserialize(string str) throws SmtpError {
|
||||||
switch (Ascii.strdown(str)) {
|
switch (str.down()) {
|
||||||
case "helo":
|
case "helo":
|
||||||
return HELO;
|
return HELO;
|
||||||
|
|
||||||
case "ehlo":
|
case "ehlo":
|
||||||
return EHLO;
|
return EHLO;
|
||||||
|
|
||||||
case "quit":
|
case "quit":
|
||||||
return QUIT;
|
return QUIT;
|
||||||
|
|
||||||
case "help":
|
case "help":
|
||||||
return HELP;
|
return HELP;
|
||||||
|
|
||||||
case "noop":
|
case "noop":
|
||||||
return NOOP;
|
return NOOP;
|
||||||
|
|
||||||
case "rset":
|
case "rset":
|
||||||
return RSET;
|
return RSET;
|
||||||
|
|
||||||
case "auth":
|
case "auth":
|
||||||
return AUTH;
|
return AUTH;
|
||||||
|
|
||||||
case "mail":
|
case "mail":
|
||||||
return MAIL;
|
return MAIL;
|
||||||
|
|
||||||
case "rcpt":
|
case "rcpt":
|
||||||
return RCPT;
|
return RCPT;
|
||||||
|
|
||||||
case "data":
|
case "data":
|
||||||
return DATA;
|
return DATA;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,21 +25,21 @@ public class Geary.Smtp.Greeting : Response {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ServerFlavor deserialize(string str) {
|
public static ServerFlavor deserialize(string str) {
|
||||||
switch (Ascii.strup(str)) {
|
switch (str.up()) {
|
||||||
case "SMTP":
|
case "SMTP":
|
||||||
return SMTP;
|
return SMTP;
|
||||||
|
|
||||||
case "ESMTP":
|
case "ESMTP":
|
||||||
return ESMTP;
|
return ESMTP;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return UNSPECIFIED;
|
return UNSPECIFIED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string? domain { get; private set; default = null; }
|
public string? domain { get; private set; default = null; }
|
||||||
public ServerFlavor flavor { get; private set; default = ServerFlavor.UNSPECIFIED; }
|
public ServerFlavor flavor { get; private set; default = ServerFlavor.UNSPECIFIED; }
|
||||||
public string? message { get; private set; default = null; }
|
public string? message { get; private set; default = null; }
|
||||||
|
|
|
||||||
|
|
@ -4,71 +4,40 @@
|
||||||
* (version 2.1 or later). See the COPYING file in this distribution.
|
* (version 2.1 or later). See the COPYING file in this distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// These calls are bound to the string class in Vala 0.26. When that version of Vala is the
|
|
||||||
// minimum, these can be dropped and Ascii.strup and Ascii.strdown can use the string methods.
|
|
||||||
extern string g_ascii_strup(string str, ssize_t len = -1);
|
|
||||||
extern string g_ascii_strdown(string str, ssize_t len = -1);
|
|
||||||
|
|
||||||
namespace Geary.Ascii {
|
namespace Geary.Ascii {
|
||||||
|
|
||||||
public int index_of(string str, char ch) {
|
|
||||||
char *strptr = str;
|
|
||||||
int index = 0;
|
|
||||||
for (;;) {
|
|
||||||
char strch = *strptr++;
|
|
||||||
|
|
||||||
if (strch == String.EOS)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (strch == ch)
|
|
||||||
return index;
|
|
||||||
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool get_next_char(string str, ref int index, out char ch) {
|
public bool get_next_char(string str, ref int index, out char ch) {
|
||||||
ch = str[index++];
|
ch = str[index++];
|
||||||
|
|
||||||
return ch != String.EOS;
|
return ch != String.EOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public inline int strcmp(string a, string b) {
|
public bool stri_equal(string a, string b) {
|
||||||
return GLib.strcmp(a, b);
|
// XXX Is this marginally faster than a.down() == b.down() in the
|
||||||
}
|
// best case, slower in the worse case, so not worth it?
|
||||||
|
|
||||||
public int stricmp(string a, string b) {
|
|
||||||
char *aptr = a;
|
char *aptr = a;
|
||||||
char *bptr = b;
|
char *bptr = b;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int diff = (int) (*aptr).tolower() - (int) (*bptr).tolower();
|
int diff = (int) (*aptr).tolower() - (int) (*bptr).tolower();
|
||||||
if (diff != 0)
|
if (diff != 0)
|
||||||
return diff;
|
return false;
|
||||||
|
|
||||||
if (*aptr == String.EOS)
|
if (*aptr == String.EOS)
|
||||||
return 0;
|
return true;
|
||||||
|
|
||||||
aptr++;
|
aptr++;
|
||||||
bptr++;
|
bptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public inline bool str_equal(string a, string b) {
|
|
||||||
return a == b;
|
|
||||||
}
|
|
||||||
|
|
||||||
public inline bool stri_equal(string a, string b) {
|
|
||||||
return stricmp(a, b) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool nullable_stri_equal(string? a, string? b) {
|
public bool nullable_stri_equal(string? a, string? b) {
|
||||||
if (a == null)
|
if (a == null)
|
||||||
return (b == null);
|
return (b == null);
|
||||||
|
|
||||||
// a != null, so always false
|
// a != null, so always false
|
||||||
if (b == null)
|
if (b == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return stri_equal(a, b);
|
return stri_equal(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -86,14 +55,6 @@ public uint nullable_stri_hash(string? str) {
|
||||||
return (str != null) ? stri_hash(str) : 0;
|
return (str != null) ? stri_hash(str) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string strdown(string str) {
|
|
||||||
return g_ascii_strdown(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string strup(string str) {
|
|
||||||
return g_ascii_strup(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the ASCII string contains only whitespace and at least one numeric character.
|
* Returns true if the ASCII string contains only whitespace and at least one numeric character.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue