unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob 28ce60018e1aa219a33b7865a7332d1a4436a651 976 bytes (raw)
name: util/unicode-util.c 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 
#include "unicode-util.h"

/* Based on Xapian::Unicode::is_wordchar, to avoid forcing clients to
   link directly to libxapian.
*/

static bool
unicode_is_wordchar (notmuch_unichar ch)
{
    switch (g_unichar_type (ch)) {
    case G_UNICODE_UPPERCASE_LETTER:
    case G_UNICODE_LOWERCASE_LETTER:
    case G_UNICODE_TITLECASE_LETTER:
    case G_UNICODE_MODIFIER_LETTER:
    case G_UNICODE_OTHER_LETTER:
    case G_UNICODE_NON_SPACING_MARK:
    case G_UNICODE_ENCLOSING_MARK:
    case G_UNICODE_SPACING_MARK:
    case G_UNICODE_DECIMAL_NUMBER:
    case G_UNICODE_LETTER_NUMBER:
    case G_UNICODE_OTHER_NUMBER:
    case G_UNICODE_CONNECT_PUNCTUATION:
	return true;
    default:
	return false;
    }
}

bool
unicode_word_utf8 (const char *utf8_str)
{
    gunichar *decoded=g_utf8_to_ucs4_fast (utf8_str, -1, NULL);
    const gunichar *p = decoded;
    bool ret;

    while (*p && unicode_is_wordchar (*p))
	p++;

    ret =  (*p == '\0');

    g_free (decoded);
    return ret;
}

debug log:

solving 28ce6001 ...
found 28ce6001 in https://yhetil.org/notmuch/20190428231049.15737-2-david@tethera.net/

applying [1/1] https://yhetil.org/notmuch/20190428231049.15737-2-david@tethera.net/
diff --git a/util/unicode-util.c b/util/unicode-util.c
new file mode 100644
index 00000000..28ce6001

Checking patch util/unicode-util.c...
Applied patch util/unicode-util.c cleanly.

index at:
100644 28ce60018e1aa219a33b7865a7332d1a4436a651	util/unicode-util.c

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).