Commit d874d766 authored by Max Kellermann's avatar Max Kellermann

mapper: add "pure" attributes

parent 1d66e714
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#ifndef MPD_MAPPER_H #ifndef MPD_MAPPER_H
#define MPD_MAPPER_H #define MPD_MAPPER_H
#include <glib.h>
#include <stdbool.h> #include <stdbool.h>
#define PLAYLIST_FILE_SUFFIX ".m3u" #define PLAYLIST_FILE_SUFFIX ".m3u"
...@@ -38,6 +39,7 @@ void mapper_finish(void); ...@@ -38,6 +39,7 @@ void mapper_finish(void);
/** /**
* Returns true if a music directory was configured. * Returns true if a music directory was configured.
*/ */
G_GNUC_CONST
bool bool
mapper_has_music_directory(void); mapper_has_music_directory(void);
...@@ -46,6 +48,7 @@ mapper_has_music_directory(void); ...@@ -46,6 +48,7 @@ mapper_has_music_directory(void);
* this function converts it to a relative path. If not, it returns * this function converts it to a relative path. If not, it returns
* the unmodified string pointer. * the unmodified string pointer.
*/ */
G_GNUC_PURE
const char * const char *
map_to_relative_path(const char *path_utf8); map_to_relative_path(const char *path_utf8);
...@@ -54,6 +57,7 @@ map_to_relative_path(const char *path_utf8); ...@@ -54,6 +57,7 @@ map_to_relative_path(const char *path_utf8);
* is basically done by converting the URI to the file system charset * is basically done by converting the URI to the file system charset
* and prepending the music directory. * and prepending the music directory.
*/ */
G_GNUC_MALLOC
char * char *
map_uri_fs(const char *uri); map_uri_fs(const char *uri);
...@@ -63,6 +67,7 @@ map_uri_fs(const char *uri); ...@@ -63,6 +67,7 @@ map_uri_fs(const char *uri);
* @param directory the directory object * @param directory the directory object
* @return the path in file system encoding, or NULL if mapping failed * @return the path in file system encoding, or NULL if mapping failed
*/ */
G_GNUC_MALLOC
char * char *
map_directory_fs(const struct directory *directory); map_directory_fs(const struct directory *directory);
...@@ -74,6 +79,7 @@ map_directory_fs(const struct directory *directory); ...@@ -74,6 +79,7 @@ map_directory_fs(const struct directory *directory);
* @param name the child's name in UTF-8 * @param name the child's name in UTF-8
* @return the path in file system encoding, or NULL if mapping failed * @return the path in file system encoding, or NULL if mapping failed
*/ */
G_GNUC_MALLOC
char * char *
map_directory_child_fs(const struct directory *directory, const char *name); map_directory_child_fs(const struct directory *directory, const char *name);
...@@ -84,6 +90,7 @@ map_directory_child_fs(const struct directory *directory, const char *name); ...@@ -84,6 +90,7 @@ map_directory_child_fs(const struct directory *directory, const char *name);
* @param song the song object * @param song the song object
* @return the path in file system encoding, or NULL if mapping failed * @return the path in file system encoding, or NULL if mapping failed
*/ */
G_GNUC_MALLOC
char * char *
map_song_fs(const struct song *song); map_song_fs(const struct song *song);
...@@ -94,12 +101,14 @@ map_song_fs(const struct song *song); ...@@ -94,12 +101,14 @@ map_song_fs(const struct song *song);
* @param path_fs a path in file system encoding * @param path_fs a path in file system encoding
* @return the relative path in UTF-8, or NULL if mapping failed * @return the relative path in UTF-8, or NULL if mapping failed
*/ */
G_GNUC_MALLOC
char * char *
map_fs_to_utf8(const char *path_fs); map_fs_to_utf8(const char *path_fs);
/** /**
* Returns the playlist directory. * Returns the playlist directory.
*/ */
G_GNUC_CONST
const char * const char *
map_spl_path(void); map_spl_path(void);
...@@ -110,6 +119,7 @@ map_spl_path(void); ...@@ -110,6 +119,7 @@ map_spl_path(void);
* *
* @return the path in file system encoding, or NULL if mapping failed * @return the path in file system encoding, or NULL if mapping failed
*/ */
G_GNUC_PURE
char * char *
map_spl_utf8_to_fs(const char *name); map_spl_utf8_to_fs(const char *name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment