From owner-freebsd-current Wed Mar 15 08:35:58 1995 Return-Path: current-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id IAA04029 for current-outgoing; Wed, 15 Mar 1995 08:35:58 -0800 Received: from lirmm.lirmm.fr (lirmm.lirmm.fr [193.49.104.10]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id IAA04021 for ; Wed, 15 Mar 1995 08:35:52 -0800 Received: from lirmm.fr (baobab.lirmm.fr [193.49.106.14]) by lirmm.lirmm.fr (8.6.10/8.6.4) with ESMTP id RAA08046 for ; Wed, 15 Mar 1995 17:34:27 +0100 Message-Id: <199503151634.RAA08046@lirmm.lirmm.fr> To: current@FreeBSD.org Subject: scsi_sense Date: Wed, 15 Mar 1995 17:22:15 +0100 From: "Philippe Charnier" Sender: current-owner@FreeBSD.org Precedence: bulk Hello, from scsi_sence.c (in src/sys/scsi) {0x26, 0x03, "Threshold parameters not supported" }, {0x46, 0x00, "Unsuccessful soft reset" }, #endif /* NO_SCSI_SENSE */ {0xff, 0xff, 0 }, }; char *scsi_sense_desc(int asc, int ascq) { int i; for (i = 0; i < sizeof(tab) / sizeof(tab[0]); i++) if (tab[i].asc == asc && tab[i].ascq == ascq) return tab[i].desc; return "no available sense description"; } Why this code don't use {0xff, 0xff, 0 } as a end of list? What about something like this? char *scsi_sense_desc(int asc, int ascq) { int i; i = -1; while (tab[++i].desc) if (tab[i].asc == asc && tab[i].ascq == ascq) return tab[i].desc; return "no available sense description"; } -------- -------- Philippe Charnier charnier@lirmm.fr LIRMM, 161 rue Ada, 34392 Montpellier cedex 5 -- France ------------------------------------------------------------------------