Re: remove uaudio_id_name()

2018-07-29 Thread Klemens Nanni
On Sun, Jul 29, 2018 at 09:31:51PM +0800, Michael W. Bombardieri wrote:
> The function uaudio_id_name() was used once for formatting a string
> and its return value was used to format a second string. By rolling
> the prepended letter "i" into the outer snprintf() the function can
> be removed entirely. Does this look correct?
No other users, `*sc' and `*iot' are already unused... looks good to me.



remove uaudio_id_name()

2018-07-29 Thread Michael W. Bombardieri
Hello,

The function uaudio_id_name() was used once for formatting a string
and its return value was used to format a second string. By rolling
the prepended letter "i" into the outer snprintf() the function can
be removed entirely. Does this look correct?

- Michael


Index: uaudio.c
===
RCS file: /cvs/src/sys/dev/usb/uaudio.c,v
retrieving revision 1.130
diff -u -p -u -r1.130 uaudio.c
--- uaudio.c27 Jul 2018 05:48:59 -  1.130
+++ uaudio.c29 Jul 2018 13:22:04 -
@@ -314,8 +314,6 @@ const usb_interface_descriptor_t *uaudio
(const char *, int, int *, int, int);
 
 void   uaudio_mixer_add_ctl(struct uaudio_softc *, struct mixerctl *);
-char   *uaudio_id_name
-   (struct uaudio_softc *, const struct io_terminal *, int);
 uByte  uaudio_get_cluster_nchan
(int, const struct io_terminal *);
 void   uaudio_add_input
@@ -672,14 +670,6 @@ uaudio_mixer_add_ctl(struct uaudio_softc
 #endif
 }
 
-char *
-uaudio_id_name(struct uaudio_softc *sc, const struct io_terminal *iot, int id)
-{
-   static char buf[32];
-   snprintf(buf, sizeof(buf), "i%d", id);
-   return (buf);
-}
-
 uByte
 uaudio_get_cluster_nchan(int id, const struct io_terminal *iot)
 {
@@ -805,9 +795,8 @@ uaudio_add_mixer(struct uaudio_softc *sc
mix.wValue[k++] =
MAKE(p+c+1, o+1);
}
-   snprintf(mix.ctlname, sizeof(mix.ctlname), "mix%d-%s",
-   d->bUnitId, uaudio_id_name(sc, iot,
-   d->baSourceId[i]));
+   snprintf(mix.ctlname, sizeof(mix.ctlname), "mix%d-i%d",
+   d->bUnitId, d->baSourceId[i]);
mix.nchan = chs;
uaudio_mixer_add_ctl(sc, );
} else {