Skip to content

Commit

Permalink
A tail recursion has been eliminated. (Thanks to @4061N) (closes fuku…
Browse files Browse the repository at this point in the history
  • Loading branch information
fukuchi committed Aug 28, 2020
1 parent 4fdf22a commit b7b4760
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Version 4.1.0 (2020.8.xx)
* Various CMake support improvements. (Thanks to @mgorny and @sdf5)
* Some minor bug fixes. (Thanks to Lonnie Abelbeck and Frédéric Wang)
* Some documentation/manpage improvements. (Thanks to Dan Jacobson)
* Some performance improvements. (Thanks to @4061N and Mika Lindqvist)

Release Note:
The internal representation of the output code has been slightly changed -
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,13 @@ Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q
- improved CMake support
* @vanillahsu - bug fix patch
* @Ation - bug fix patch
* Jonathan Bennett - Addedd "--inline" option to qrencode
* Jonathan Bennett - Added "--inline" option to qrencode
* András Veres-Szentkirályi
- ANSI256UTF8 support
* @sdf5 - improved CMake support
* Lonnie Abelbeck (@abelbeck)
- bug fix patch
* @4061N - performance improvement patch
* Rosen Penev (@neheb) - CMake bug fix patch
* Shigeyuki Hirai, Paul Janssens, wangsai, Gavan Fantom, Matthew Baker,
Rob Ryan, Fred Steinhaeuser, Terry Burton, @chisj, @vlad417, Petr,
Expand All @@ -224,5 +225,5 @@ Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q
Antenore Gatta, Yoshimichi Inoue, Sunil Maganally, Norman Gray,
Danomi Manchego, @minus7, Ian Sweet, @qianchenglenger, Ronald Michaels,
Yuji Ueno, Jakub Wilk, @KangLin, @c-273, @thebunnyrules, @NancyLi1013,
Frédéric Wang, Dan Jacobson
Frédéric Wang, Dan Jacobson, Mika Lindqvist
- bug report / suggestion / typo fixes
30 changes: 16 additions & 14 deletions split.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,21 +257,23 @@ static int Split_splitString(const char *string, QRinput *input,
int length;
QRencodeMode mode;

if(*string == '\0') return 0;

mode = Split_identifyMode(string, hint);
if(mode == QR_MODE_NUM) {
length = Split_eatNum(string, input, hint);
} else if(mode == QR_MODE_AN) {
length = Split_eatAn(string, input, hint);
} else if(mode == QR_MODE_KANJI && hint == QR_MODE_KANJI) {
length = Split_eatKanji(string, input, hint);
} else {
length = Split_eat8(string, input, hint);
while(*string != '\0') {
mode = Split_identifyMode(string, hint);
if(mode == QR_MODE_NUM) {
length = Split_eatNum(string, input, hint);
} else if(mode == QR_MODE_AN) {
length = Split_eatAn(string, input, hint);
} else if(mode == QR_MODE_KANJI && hint == QR_MODE_KANJI) {
length = Split_eatKanji(string, input, hint);
} else {
length = Split_eat8(string, input, hint);
}
if(length == 0) break;
if(length < 0) return -1;
string += length;
}
if(length == 0) return 0;
if(length < 0) return -1;
return Split_splitString(&string[length], input, hint);

return 0;
}

static char *dupAndToUpper(const char *str, QRencodeMode hint)
Expand Down

0 comments on commit b7b4760

Please sign in to comment.