grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCHv2] dprintf implementation


From: Vincent Pelletier
Subject: Re: [PATCHv2] dprintf implementation
Date: Fri, 25 Feb 2005 19:04:57 +0100
User-agent: Debian Thunderbird 1.0 (X11/20050116)

Yoshinori K. Okuji wrote:
On Friday 25 February 2005 17:02, Hollis Blanchard wrote:
int
grub_strword (const char *haystack, const char *needle)
{
    int pos = 0;
    int found = 0;

    while (haystack[pos]) {
        /* Advance to next word. */
        while (grub_iswordseparator (haystack[pos]))
            pos++;

        if (0 == grub_strcmp (&haystack[pos], needle))
            {
                found = 1;
                break;
            }
    }

    return found;
}

What about grub_strword("all,foo","all") ?
Wouldn't strcmp tell that {'a','l','l',',',...,'\0'} and {'a','l','l','\0'} are different ?

grub_strword ("filesystem", "file") returns 0 in your implementation.

Isn't it what should happen ?
If we use 2 similar words, one being a substring of the other, I don't think the substring should make the larger match too. Or we might add a hierarchy thing (filesystem/inode, filesystem/block, kern/alloc, kern/term/font/draw, ...) where "filesystem" would match all "filesystem/*" ad "filesystem/inode" would only match that one.

Hollis: mmh, I bet you'll say it's overcomplicated :). And I think you're right. The more I think about such "simple" debug func, the more I feel like I'll take over the world of debugging system... Well, time to find some more of those nice mushrooms ;). And a clean paper to write those 500 Changelog entries.

Vincent Pelletier






reply via email to

[Prev in Thread] Current Thread [Next in Thread]