lib/avahi/Publisher: use libfmt

This commit is contained in:
Max Kellermann 2023-03-06 19:57:53 +01:00
parent 1132a1c9a7
commit 00d5e6e9c7
1 changed files with 4 additions and 5 deletions

View File

@ -13,9 +13,10 @@
#include <avahi-common/malloc.h>
#include <avahi-common/alternative.h>
#include <fmt/core.h>
#include <cassert>
#include <stdio.h>
#include <unistd.h>
namespace Avahi {
@ -31,11 +32,9 @@ namespace Avahi {
* AVAHI_BROWSER_NEW.
*/
static std::string
MakePidName(const char *prefix)
MakePidName(const char *prefix) noexcept
{
char buffer[256];
snprintf(buffer, sizeof(buffer), "%s[%u]", prefix, (unsigned)getpid());
return buffer;
return fmt::format("{}[{}]", prefix, getpid());
}
Publisher::Publisher(Client &_client, const char *_name,