projects
/
open-adventure.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
278e9c8
)
Make compparuson out to TOKLEN only explicit in vocab lookups.
author
Eric S. Raymond
<esr@thyrsus.com>
Thu, 20 Jul 2017 09:54:55 +0000
(
05:54
-0400)
committer
Eric S. Raymond
<esr@thyrsus.com>
Thu, 20 Jul 2017 09:54:55 +0000
(
05:54
-0400)
misc.c
patch
|
blob
|
history
diff --git
a/misc.c
b/misc.c
index f3b0f3dcf33675cf166e45d50689d42064bade2a..ae5048d9a92825b948f770c4b218f9f83559abc8 100644
(file)
--- a/
misc.c
+++ b/
misc.c
@@
-462,7
+462,7
@@
int get_motion_vocab_id(const char* word)
{
for (int i = 0; i < NMOTIONS; ++i) {
for (int j = 0; j < motions[i].words.n; ++j) {
{
for (int i = 0; i < NMOTIONS; ++i) {
for (int j = 0; j < motions[i].words.n; ++j) {
- if (str
casecmp(word, motions[i].words.strs[j]
) == 0 && (strlen(word) > 1 ||
+ if (str
ncasecmp(word, motions[i].words.strs[j], TOKLEN
) == 0 && (strlen(word) > 1 ||
strchr(ignore, word[0]) == NULL ||
!settings.oldstyle))
return (i);
strchr(ignore, word[0]) == NULL ||
!settings.oldstyle))
return (i);
@@
-477,7
+477,7
@@
int get_object_vocab_id(const char* word)
{
for (int i = 0; i < NOBJECTS + 1; ++i) { // FIXME: the + 1 should go when 1-indexing for objects is removed
for (int j = 0; j < objects[i].words.n; ++j) {
{
for (int i = 0; i < NOBJECTS + 1; ++i) { // FIXME: the + 1 should go when 1-indexing for objects is removed
for (int j = 0; j < objects[i].words.n; ++j) {
- if (str
casecmp(word, objects[i].words.strs[j]
) == 0)
+ if (str
ncasecmp(word, objects[i].words.strs[j], TOKLEN
) == 0)
return (i);
}
}
return (i);
}
}
@@
-490,7
+490,7
@@
int get_action_vocab_id(const char* word)
{
for (int i = 0; i < NACTIONS; ++i) {
for (int j = 0; j < actions[i].words.n; ++j) {
{
for (int i = 0; i < NACTIONS; ++i) {
for (int j = 0; j < actions[i].words.n; ++j) {
- if (str
casecmp(word, actions[i].words.strs[j]
) == 0 && (strlen(word) > 1 ||
+ if (str
ncasecmp(word, actions[i].words.strs[j], TOKLEN
) == 0 && (strlen(word) > 1 ||
strchr(ignore, word[0]) == NULL ||
!settings.oldstyle))
return (i);
strchr(ignore, word[0]) == NULL ||
!settings.oldstyle))
return (i);
@@
-505,7
+505,7
@@
int get_special_vocab_id(const char* word)
{
for (int i = 0; i < NSPECIALS; ++i) {
for (int j = 0; j < specials[i].words.n; ++j) {
{
for (int i = 0; i < NSPECIALS; ++i) {
for (int j = 0; j < specials[i].words.n; ++j) {
- if (str
casecmp(word, specials[i].words.strs[j]
) == 0)
+ if (str
ncasecmp(word, specials[i].words.strs[j], TOKLEN
) == 0)
return (i);
}
}
return (i);
}
}