[sane-devel] coolscan2 in 1.0.8

Frank Zago fzago@greshamstorage.com
Sun, 14 Apr 2002 16:20:19 -0500 (CDT)


Hi Andreas,

> > You should also remove the default case in the switch (interface)
> > in cs2_open() and enumerates all the cases instead. gcc will warn if
> > there is some missing cases.
>
> I've done that, but what is the reason for this? Why shouldn't I use
> default instead of CS2_INTERFACE_UNKNOWN, which in all but one case
> would lead to an error anyway?

When a switch is done on an "enum" type, gcc can tell if one is missing in
the switch. Adding a default: defeat its purpose.

> > same function, if sp is NULL, s is always leaked.
>
> No, because cs2_close() is called.

Right.

It looks better now.

Frank.