int NRL(char *s, unsigned int n, darray_ptr phone) { int old = phone->items; unsigned char *word = (unsigned char *) malloc(n + 3); unsigned char *d = word; *d++ = ' '; while (n-- > 0) { unsigned ch = *s++ & 0xFF; if (isupper(ch)) ch = tolower(ch); *d++ = ch; } *d++ = ' '; *d = '\0'; guess_word(phone, darray_cat, word); free(word); return phone->items - old; }
static int NRL(const char *s, int n, darray *phone) { int old = phone->getSize(); char *word = (char *) malloc(n + 3); char *d = word; *d++ = ' '; while (n-- > 0) { char ch = *s++; if (islower(ch)) ch = toupper(ch); *d++ = ch; } *d++ = ' '; // kinda unnecessary *d = '\0'; guess_word(phone, word); free(word); return phone->getSize() - old; }