On Thu, Feb 20, 2023 at 17:55 Stanislaw Gruszka <stanislaw.gruszka@xxxxxxxxxxxxxxx> wrote: > On Fri, Feb 17, 2023 at 11:34:39AM +0000, Tomer Tayar wrote: > > > > > Ok, just place replace compose_device_in_use_info() with snprintf(). > > > I don't think you need custom implementation of snprintf(). > > > > compose_device_in_use_info() was added to handle in a single place the > snprintf() return value and the buffer pointer moving. > > However, you are correct and it is too much here, as the local buffer size is set > with a value that should be enough for max possible print. > > We will remove compose_device_in_use_info() and use snprintf() directly. > > Actually the safer version would be scnprintf() since for that function > return value could not be bigger than passed len. Usage then could be > as simple as: > > n += scnprintf(buf + n, len - n, ...); > n += scnprintf(buf + n, len - n, ...); > > Regards > Stanislaw Sure, we will use it, thanks!