Re: [PATCH 4/13] FAT: Return better error codes from vfat_valid_longname()
From: Rogério Brito (rbrito_at_ime.usp.br)
Date: 01/18/05
- Previous message: Roland McGrath: "[PATCH] cputime.h seems to assume HZ==1000"
- In reply to: OGAWA Hirofumi: "[PATCH 4/13] FAT: Return better error codes from vfat_valid_longname()"
- Next in thread: OGAWA Hirofumi: "Re: [PATCH 4/13] FAT: Return better error codes from vfat_valid_longname()"
- Reply: OGAWA Hirofumi: "Re: [PATCH 4/13] FAT: Return better error codes from vfat_valid_longname()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 18 Jan 2005 00:03:25 -0200 To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
On Jan 18 2005, OGAWA Hirofumi wrote:
> static int vfat_valid_longname(const unsigned char *name, unsigned int len)
> {
> - if (len && name[len-1] == ' ')
> - return 0;
> + if (name[len - 1] == ' ')
> + return -EINVAL;
Sorry for the stupid question, but is len guaranteed to be always greater
than zero?
Otherwise, I think that the test with len would be warranted. And, if that
is the case, wouldn't it be better to have it explicitly say if (len > 0...)?
Just curious. And sorry again for the stupid question. But as Knuth says,
"premature optimization is the root of all evil".
Perhaps I'm way too much into proving invariants of algorithms. :-)
Thanks for your work, Rogério.
-- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Rogério Brito - rbrito@ime.usp.br - http://www.ime.usp.br/~rbrito =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Previous message: Roland McGrath: "[PATCH] cputime.h seems to assume HZ==1000"
- In reply to: OGAWA Hirofumi: "[PATCH 4/13] FAT: Return better error codes from vfat_valid_longname()"
- Next in thread: OGAWA Hirofumi: "Re: [PATCH 4/13] FAT: Return better error codes from vfat_valid_longname()"
- Reply: OGAWA Hirofumi: "Re: [PATCH 4/13] FAT: Return better error codes from vfat_valid_longname()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|