Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
47463e57
Commit
47463e57
authored
Jan 20, 2022
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-27552 Change the return type of my_uca_context_weight_find() to MY_CONTRACTION*
parent
fdec8852
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
28 deletions
+30
-28
strings/ctype-uca.c
strings/ctype-uca.c
+24
-22
strings/ctype-uca.ic
strings/ctype-uca.ic
+6
-6
No files found.
strings/ctype-uca.c
View file @
47463e57
...
...
@@ -31460,11 +31460,11 @@ my_wmemcmp(my_wc_t *a, my_wc_t *b, size_t len)
@return Weight array
@retval NULL - Input string is not a known contraction
@retval ptr -
contraction weight array
@retval ptr -
the address of the MY_CONTRACTION found
*/
static inline
uint16
*
my_uca_contraction_
weight
(const MY_CONTRACTIONS *list, my_wc_t *wc, size_t len)
static inline
const MY_CONTRACTION
*
my_uca_contraction_
find
(const MY_CONTRACTIONS *list, my_wc_t *wc, size_t len)
{
MY_CONTRACTION *c, *last;
DBUG_ASSERT(len <= MY_UCA_MAX_CONTRACTION);
...
...
@@ -31474,7 +31474,7 @@ my_uca_contraction_weight(const MY_CONTRACTIONS *list, my_wc_t *wc, size_t len)
if ((len >= MY_UCA_MAX_CONTRACTION || c->ch[len] == 0) &&
!c->with_context &&
!my_wmemcmp(c->ch, wc, len))
return c
->weight
;
return c;
}
return NULL;
}
...
...
@@ -31492,10 +31492,10 @@ my_uca_contraction_weight(const MY_CONTRACTIONS *list, my_wc_t *wc, size_t len)
@return Weight array
@retval NULL - no contraction found
@retval ptr -
contraction weight array
@retval ptr -
the address of MY_CONTRACTION found
*/
static
uint16
*
static
const MY_CONTRACTION
*
my_uca_scanner_contraction_find(my_uca_scanner *scanner, my_wc_t *wc)
{
size_t clen= 1;
...
...
@@ -31521,15 +31521,15 @@ my_uca_scanner_contraction_find(my_uca_scanner *scanner, my_wc_t *wc)
/* Find among candidates the longest real contraction */
for ( ; clen > 1; clen--)
{
uint16 *cweigh
t;
const MY_CONTRACTION *cn
t;
if (my_uca_can_be_contraction_tail(&scanner->level->contractions,
wc[clen - 1]) &&
(c
weight= my_uca_contraction_weight
(&scanner->level->contractions,
(c
nt= my_uca_contraction_find
(&scanner->level->contractions,
wc, clen)))
{
scanner->wbeg= cweight + 1;
scanner->wbeg= c
nt->
weight + 1;
scanner->sbeg= beg[clen - 1];
return c
weigh
t;
return c
n
t;
}
}
...
...
@@ -31547,10 +31547,10 @@ my_uca_scanner_contraction_find(my_uca_scanner *scanner, my_wc_t *wc)
@return Weight array
@retval NULL - no contraction with context found
@retval ptr -
contraction weight array
@retval ptr -
the address of MY_CONTRACTION found
*/
static
uint16
*
static
const MY_CONTRACTION
*
my_uca_previous_context_find(my_uca_scanner *scanner,
my_wc_t wc0, my_wc_t wc1)
{
...
...
@@ -31561,7 +31561,7 @@ my_uca_previous_context_find(my_uca_scanner *scanner,
if (c->with_context && wc0 == c->ch[0] && wc1 == c->ch[1])
{
scanner->wbeg= c->weight + 1;
return c
->weight
;
return c;
}
}
return NULL;
...
...
@@ -31583,12 +31583,12 @@ my_uca_previous_context_find(my_uca_scanner *scanner,
pair, then wc[1] is set to the previous character.
@retval NULL if could not find any contextual weights for wc[0]
@retval non null pointer
to a zero-terminated weight string otherwise
@retval non null pointer
- the address of MY_CONTRACTION found
*/
static inline
uint16
*
static inline
const MY_CONTRACTION
*
my_uca_context_weight_find(my_uca_scanner *scanner, my_wc_t *wc)
{
uint16 *cweigh
t;
const MY_CONTRACTION *cn
t;
DBUG_ASSERT(scanner->level->contractions.nitems);
/*
If we have scanned a character which can have previous context,
...
...
@@ -31605,17 +31605,17 @@ my_uca_context_weight_find(my_uca_scanner *scanner, my_wc_t *wc)
my_uca_can_be_previous_context_head(&scanner->level->contractions,
(wc[1]= ((scanner->page << 8) +
scanner->code))) &&
(c
weigh
t= my_uca_previous_context_find(scanner, wc[1], wc[0])))
(c
n
t= my_uca_previous_context_find(scanner, wc[1], wc[0])))
{
scanner->page= scanner->code= 0; /* Clear for the next character */
return c
weigh
t;
return c
n
t;
}
else if (my_uca_can_be_contraction_head(&scanner->level->contractions,
wc[0]))
{
/* Check if w[0] starts a contraction */
if ((c
weigh
t= my_uca_scanner_contraction_find(scanner, wc)))
return c
weigh
t;
if ((c
n
t= my_uca_scanner_contraction_find(scanner, wc)))
return c
n
t;
}
return NULL;
}
...
...
@@ -33214,9 +33214,11 @@ my_char_weight_put(MY_UCA_WEIGHT_LEVEL *dst,
for (chlen= len; chlen > 1; chlen--)
{
const MY_CONTRACTION *cnt;
if (chlen <= MY_UCA_MAX_CONTRACTION &&
(
from= my_uca_contraction_weight
(&dst->contractions, str, chlen)))
(
cnt= my_uca_contraction_find
(&dst->contractions, str, chlen)))
{
from= cnt->weight;
str+= chlen;
len-= chlen;
break;
strings/ctype-uca.ic
View file @
47463e57
...
...
@@ -65,9 +65,9 @@ MY_FUNCTION_NAME(scanner_next)(my_uca_scanner *scanner)
#if MY_UCA_COMPILE_CONTRACTIONS
if (my_uca_needs_context_handling(scanner->level, wc[0]))
{
uint16 *cweigh
t= my_uca_context_weight_find(scanner, wc);
if (c
weigh
t)
return
*cweight
;
const MY_CONTRACTION *cn
t= my_uca_context_weight_find(scanner, wc);
if (c
n
t)
return
cnt->weight[0]
;
}
#endif
...
...
@@ -114,9 +114,9 @@ MY_FUNCTION_NAME(scanner_next)(my_uca_scanner *scanner)
#if MY_UCA_COMPILE_CONTRACTIONS
if (my_uca_needs_context_handling(scanner->level, wc[0]))
{
uint16 *cweigh
t= my_uca_context_weight_find(scanner, wc);
if (c
weigh
t)
return
*cweight
;
const MY_CONTRACTION *cn
t= my_uca_context_weight_find(scanner, wc);
if (c
n
t)
return
cnt->weight[0]
;
}
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment