Do not use {0} struct initializers
authorLucas De Marchi <lucas.demarchi@intel.com>
Mon, 12 Aug 2013 14:00:15 +0000 (11:00 -0300)
committerLucas De Marchi <lucas.demarchi@intel.com>
Mon, 12 Aug 2013 17:27:38 +0000 (14:27 -0300)
Change code all over the tree with the following command, and fix up the
one false positive:

git ls-files | while read f; do sed -i 's/ = { *0.*}/ = { }/g' $f; done

12 files changed:
src/lib/lightmediascanner_db_audio.c
src/lib/lightmediascanner_db_image.c
src/lib/lightmediascanner_db_playlist.c
src/lib/lightmediascanner_db_video.c
src/plugins/audio-dummy/audio-dummy.c
src/plugins/id3/id3.c
src/plugins/jpeg/jpeg.c
src/plugins/m3u/m3u.c
src/plugins/ogg/ogg.c
src/plugins/pls/pls.c
src/plugins/png/png.c
src/plugins/video-dummy/video-dummy.c

index 3d4c610..c0532ff 100644 (file)
@@ -37,7 +37,7 @@ struct lms_db_audio {
     unsigned int _is_started:1;
 };
 
-static struct lms_db_cache _cache = {0, NULL};
+static struct lms_db_cache _cache = { };
 
 static int
 _db_create(sqlite3 *db, const char *name, const char *sql)
index ac3c7ca..5c13398 100644 (file)
@@ -32,7 +32,7 @@ struct lms_db_image {
     unsigned int _is_started:1;
 };
 
-static struct lms_db_cache _cache = {0, NULL};
+static struct lms_db_cache _cache = { };
 
 static int
 _db_table_updater_images_0(sqlite3 *db, const char *table, unsigned int current_version, int is_last_run) {
index 94966db..0cf619d 100644 (file)
@@ -32,7 +32,7 @@ struct lms_db_playlist {
     unsigned int _is_started:1;
 };
 
-static struct lms_db_cache _cache = {0, NULL};
+static struct lms_db_cache _cache = { };
 
 static int
 _db_table_updater_playlists_0(sqlite3 *db, const char *table, unsigned int current_version, int is_last_run) {
index 2241e91..abca144 100644 (file)
@@ -32,7 +32,7 @@ struct lms_db_video {
     unsigned int _is_started:1;
 };
 
-static struct lms_db_cache _cache = {0, NULL};
+static struct lms_db_cache _cache = { };
 
 static int
 _db_table_updater_videos_0(sqlite3 *db, const char *table, unsigned int current_version, int is_last_run) {
index f239707..7b217f6 100644 (file)
@@ -70,7 +70,7 @@ _match(struct plugin *p, const char *path, int len, int base)
 static int
 _parse(struct plugin *plugin, struct lms_context *ctxt, const struct lms_file_info *finfo, void *match)
 {
-    struct lms_audio_info info = {0};
+    struct lms_audio_info info = { };
     int r;
     long ext_idx;
 
index d9e4bcf..a1c6d11 100644 (file)
@@ -514,7 +514,7 @@ _get_id3v2_artist(unsigned int index, const char *frame_data, unsigned int frame
         return 1;
 
     if (artist_priorities[index] > info->cur_artist_priority) {
-        struct lms_string_size artist = {0};
+        struct lms_string_size artist = { };
 
         _get_id3v2_frame_info(frame_data, frame_size, &artist, cs_conv, 1);
         if (artist.str) {
@@ -561,7 +561,7 @@ static void
 _get_id3v2_genre(const char *frame_data, unsigned int frame_size, struct lms_string_size *out, lms_charset_conv_t *cs_conv)
 {
     unsigned int i, is_number;
-    struct lms_string_size genre = {0};
+    struct lms_string_size genre = { };
 
     _get_id3v2_frame_info(frame_data, frame_size, &genre, cs_conv, 1);
     if (!genre.str)
@@ -627,7 +627,7 @@ _get_id3v2_genre(const char *frame_data, unsigned int frame_size, struct lms_str
 static void
 _get_id3v2_trackno(const char *frame_data, unsigned int frame_size, struct id3_info *info, lms_charset_conv_t *cs_conv)
 {
-    struct lms_string_size trackno = {0};
+    struct lms_string_size trackno = { };
 
     _get_id3v2_frame_info(frame_data, frame_size, &trackno, cs_conv, 0);
     if (!trackno.str)
index 39e4b9f..ac0c30e 100644 (file)
@@ -351,7 +351,7 @@ static unsigned int
 _exif_datetime_get(int fd, int offset)
 {
     char buf[20];
-    struct tm tm = {0};
+    struct tm tm = { };
 
     if (lseek(fd, offset, SEEK_SET) == -1) {
         perror("lseek");
@@ -611,7 +611,7 @@ _match(struct plugin *p, const char *path, int len, int base)
 static int
 _parse(struct plugin *plugin, struct lms_context *ctxt, const struct lms_file_info *finfo, void *match)
 {
-    struct lms_image_info info = {0};
+    struct lms_image_info info = { };
     int fd, type, len, r;
 
     fd = open(finfo->path, O_RDONLY);
index 741e64b..15a92df 100644 (file)
@@ -122,7 +122,7 @@ _match(struct plugin *p, const char *path, int len, int base)
 static int
 _parse(struct plugin *plugin, struct lms_context *ctxt, const struct lms_file_info *finfo, void *match)
 {
-    struct lms_playlist_info info = {0};
+    struct lms_playlist_info info = { };
     int fd, r;
     long ext_idx;
 
index 4889fad..320525c 100644 (file)
@@ -253,7 +253,7 @@ _match(struct plugin *p, const char *path, int len, int base)
 static int
 _parse(struct plugin *plugin, struct lms_context *ctxt, const struct lms_file_info *finfo, void *match)
 {
-    struct lms_audio_info info = {0};
+    struct lms_audio_info info = { };
     int r;
 
     r = _parse_ogg(finfo->path, &info);
index ccbb519..d2a253c 100644 (file)
@@ -303,7 +303,7 @@ _match(struct plugin *p, const char *path, int len, int base)
 static int
 _parse(struct plugin *plugin, struct lms_context *ctxt, const struct lms_file_info *finfo, void *match)
 {
-    struct lms_playlist_info info = {0};
+    struct lms_playlist_info info = { };
     int fd, r;
     long ext_idx;
 
index aab0379..46a46f1 100644 (file)
@@ -126,7 +126,7 @@ _match(struct plugin *p, const char *path, int len, int base)
 static int
 _parse(struct plugin *plugin, struct lms_context *ctxt, const struct lms_file_info *finfo, void *match)
 {
-    struct lms_image_info info = {0};
+    struct lms_image_info info = { };
     int fd, r;
 
     fd = open(finfo->path, O_RDONLY);
index 4565d14..c127e29 100644 (file)
@@ -76,7 +76,7 @@ _match(struct plugin *p, const char *path, int len, int base)
 static int
 _parse(struct plugin *plugin, struct lms_context *ctxt, const struct lms_file_info *finfo, void *match)
 {
-    struct lms_video_info info = {0};
+    struct lms_video_info info = { };
     int r;
     long ext_idx;