sticker/Database: eliminate sticker_foreach()
This commit is contained in:
parent
0dccadff89
commit
3fe7f27345
|
@ -314,16 +314,6 @@ sticker_delete_value(const char *type, const char *uri, const char *name)
|
||||||
return modified;
|
return modified;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
sticker_foreach(const Sticker &sticker,
|
|
||||||
void (*func)(const char *name, const char *value,
|
|
||||||
void *user_data),
|
|
||||||
void *user_data)
|
|
||||||
{
|
|
||||||
for (const auto &i : sticker.table)
|
|
||||||
func(i.first.c_str(), i.second.c_str(), user_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
Sticker
|
Sticker
|
||||||
sticker_load(const char *type, const char *uri)
|
sticker_load(const char *type, const char *uri)
|
||||||
{
|
{
|
||||||
|
|
|
@ -108,19 +108,6 @@ sticker_delete(const char *type, const char *uri);
|
||||||
bool
|
bool
|
||||||
sticker_delete_value(const char *type, const char *uri, const char *name);
|
sticker_delete_value(const char *type, const char *uri, const char *name);
|
||||||
|
|
||||||
/**
|
|
||||||
* Iterates over all sticker items in a sticker.
|
|
||||||
*
|
|
||||||
* @param sticker the sticker object
|
|
||||||
* @param func a callback function
|
|
||||||
* @param user_data an opaque pointer for the callback function
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
sticker_foreach(const Sticker &sticker,
|
|
||||||
void (*func)(const char *name, const char *value,
|
|
||||||
void *user_data),
|
|
||||||
void *user_data);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the sticker for the specified resource.
|
* Loads the sticker for the specified resource.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2003-2018 The Music Player Daemon Project
|
* Copyright 2003-2019 The Music Player Daemon Project
|
||||||
* http://www.musicpd.org
|
* http://www.musicpd.org
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "StickerPrint.hxx"
|
#include "StickerPrint.hxx"
|
||||||
#include "StickerDatabase.hxx"
|
#include "Sticker.hxx"
|
||||||
#include "client/Response.hxx"
|
#include "client/Response.hxx"
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -28,16 +28,9 @@ sticker_print_value(Response &r,
|
||||||
r.Format("sticker: %s=%s\n", name, value);
|
r.Format("sticker: %s=%s\n", name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
print_sticker_cb(const char *name, const char *value, void *data)
|
|
||||||
{
|
|
||||||
auto &r = *(Response *)data;
|
|
||||||
|
|
||||||
sticker_print_value(r, name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sticker_print(Response &r, const Sticker &sticker)
|
sticker_print(Response &r, const Sticker &sticker)
|
||||||
{
|
{
|
||||||
sticker_foreach(sticker, print_sticker_cb, &r);
|
for (const auto &i : sticker.table)
|
||||||
|
sticker_print_value(r, i.first.c_str(), i.second.c_str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2003-2018 The Music Player Daemon Project
|
* Copyright 2003-2019 The Music Player Daemon Project
|
||||||
* http://www.musicpd.org
|
* http://www.musicpd.org
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
|
Loading…
Reference in New Issue