From 5d5f21bfc5911f9f80b3e24871287ac58db9543f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 5 Sep 2013 18:34:12 +0200 Subject: Tag: compile-time initialisation of ignore_tag_items Move to TagSettings.c and use C99 initializers. --- src/tag/Tag.cxx | 10 +--------- src/tag/Tag.hxx | 6 ------ src/tag/TagConfig.cxx | 2 +- src/tag/TagInternal.hxx | 27 --------------------------- src/tag/TagSettings.c | 25 +++++++++++++++++++++++++ src/tag/TagSettings.h | 29 +++++++++++++++++++++++++++++ 6 files changed, 56 insertions(+), 43 deletions(-) delete mode 100644 src/tag/TagInternal.hxx create mode 100644 src/tag/TagSettings.c create mode 100644 src/tag/TagSettings.h (limited to 'src/tag') diff --git a/src/tag/Tag.cxx b/src/tag/Tag.cxx index d0e44862d..24f3ea1e9 100644 --- a/src/tag/Tag.cxx +++ b/src/tag/Tag.cxx @@ -19,9 +19,9 @@ #include "config.h" #include "Tag.hxx" -#include "TagInternal.hxx" #include "TagPool.hxx" #include "TagString.hxx" +#include "TagSettings.h" #include #include @@ -40,8 +40,6 @@ static struct { TagItem *items[BULK_MAX]; } bulk; -bool ignore_tag_items[TAG_NUM_OF_ITEM_TYPES]; - enum tag_type tag_name_parse(const char *name) { @@ -78,12 +76,6 @@ items_size(const Tag &tag) return tag.num_items * sizeof(TagItem *); } -void tag_lib_init(void) -{ - /* ignore comments by default */ - ignore_tag_items[TAG_COMMENT] = true; -} - void Tag::Clear() { diff --git a/src/tag/Tag.hxx b/src/tag/Tag.hxx index fc9ad0bbb..bfbebe671 100644 --- a/src/tag/Tag.hxx +++ b/src/tag/Tag.hxx @@ -186,10 +186,4 @@ tag_name_parse(const char *name); enum tag_type tag_name_parse_i(const char *name); -/** - * Initializes the tag library. - */ -void -tag_lib_init(); - #endif diff --git a/src/tag/TagConfig.cxx b/src/tag/TagConfig.cxx index 22f7a64fa..9e47cd05b 100644 --- a/src/tag/TagConfig.cxx +++ b/src/tag/TagConfig.cxx @@ -19,7 +19,7 @@ #include "config.h" #include "TagConfig.hxx" -#include "TagInternal.hxx" +#include "TagSettings.h" #include "Tag.hxx" #include "ConfigGlobal.hxx" #include "ConfigOption.hxx" diff --git a/src/tag/TagInternal.hxx b/src/tag/TagInternal.hxx deleted file mode 100644 index 8172d1319..000000000 --- a/src/tag/TagInternal.hxx +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2003-2013 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPD_TAG_INTERNAL_HXX -#define MPD_TAG_INTERNAL_HXX - -#include "TagType.h" - -extern bool ignore_tag_items[TAG_NUM_OF_ITEM_TYPES]; - -#endif diff --git a/src/tag/TagSettings.c b/src/tag/TagSettings.c new file mode 100644 index 000000000..eb2db2ba5 --- /dev/null +++ b/src/tag/TagSettings.c @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2003-2013 The Music Player Daemon Project + * http://www.musicpd.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "TagSettings.h" + +bool ignore_tag_items[TAG_NUM_OF_ITEM_TYPES] = { + /* ignore comments by default */ + [TAG_COMMENT] = true, +}; diff --git a/src/tag/TagSettings.h b/src/tag/TagSettings.h new file mode 100644 index 000000000..245de2df5 --- /dev/null +++ b/src/tag/TagSettings.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2003-2013 The Music Player Daemon Project + * http://www.musicpd.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPD_TAG_SETTINGS_H +#define MPD_TAG_SETTINGS_H + +#include "TagType.h" + +#include + +extern bool ignore_tag_items[TAG_NUM_OF_ITEM_TYPES]; + +#endif -- cgit v1.2.3