Remove unnecessary codes 47/232047/2
authorhj kim <backto.kim@samsung.com>
Tue, 28 Apr 2020 01:31:50 +0000 (10:31 +0900)
committerhj kim <backto.kim@samsung.com>
Tue, 28 Apr 2020 02:20:38 +0000 (11:20 +0900)
Change-Id: I042a58439b3169ed2fd5455ccedcc3f56a2cbab7

bmp/test/mm_util_bmp_testsuite.c
gif/test/mm_util_gif_testsuite.c
imgp/test/mm_util_imgp_testsuite.c
jpeg/test/mm_util_jpeg_testsuite.c
png/test/mm_util_png_testsuite.c

index 10c49e5..03754f0 100644 (file)
@@ -30,7 +30,6 @@
 #include <tzplatform_config.h>
 
 #define SAFE_FREE(x)           { if (x != NULL) { free(x); x = NULL; } }
-#define SAFE_G_FREE(x)         { if (x != NULL) { g_free(x); x = NULL; } }
 #define SAFE_IMAGE_FREE(x)     { if (x != NULL) { mm_image_destroy_image(x); x = NULL; } }
 
 #define DECODE_FILE_PATH       tzplatform_mkpath(TZ_USER_CONTENT, "bmp_test_dec_file.raw")
@@ -177,7 +176,7 @@ void _print_help(const char *argv0)
        fprintf(stderr, "\t\t1. decode & encode : %s mode path\n", argv0);
        fprintf(stderr, "\t\t2. decode : %s mode path\n", argv0);
        fprintf(stderr, "\t\t3. encode : %s mode path width height\n", argv0);
-       fprintf(stderr, "\t\t4. mode : 0 - auto, 1 - decode from file, 2 - decode from memory, 3 - encode to file, 4 - encode to memeory\n");
+       fprintf(stderr, "\t\t4. mode : 0 - auto, 1 - decode from file, 2 - decode from memory, 3 - encode to file, 4 - encode to memory\n");
 }
 
 gboolean _get_arguments(int argc, char *argv[])
@@ -191,10 +190,6 @@ gboolean _get_arguments(int argc, char *argv[])
        }
 
        g_path = g_strdup(argv[2]);
-       if (g_path == NULL) {
-               fprintf(stderr, "\t[BMP_testsuite] Not enough memory\n");
-               return FALSE;
-       }
 
        if ((g_test_mode == TEST_AUTO) || (g_test_mode == TEST_DECODE_FILE) || (g_test_mode == TEST_DECODE_MEMORY)) {
                /* do nothing */
@@ -326,12 +321,8 @@ gboolean _test_auto()
        while (test_mode < TEST_NUM) {
                fprintf(stderr, "\t[BMP_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s\' TEST START\n", MODE_TO_STR[test_mode]);
                if (TEST_ENCODE_FILE == test_mode) {
-                       SAFE_G_FREE(g_path);
+                       g_free(g_path);
                        g_path = g_strdup(DECODE_FILE_PATH);
-                       if (g_path == NULL) {
-                               fprintf(stderr, "\t[BMP_testsuite] Not enough memory\n");
-                               return FALSE;
-                       }
                }
                /* test decoding bmp */
                if ((test_mode == TEST_DECODE_FILE) || (test_mode == TEST_DECODE_MEMORY)) {
@@ -395,7 +386,7 @@ int main(int argc, char *argv[])
        }
 
 out:
-       SAFE_G_FREE(g_path);
+       g_free(g_path);
        SAFE_FREE(g_readed_data);
        SAFE_IMAGE_FREE(g_decoded_data);
 
index 99f9178..e8eefd2 100644 (file)
@@ -177,7 +177,7 @@ void _print_help(const char *argv0)
        fprintf(stderr, "\t\t1. decode & encode : %s mode path\n", argv0);
        fprintf(stderr, "\t\t2. decode : %s mode path\n", argv0);
        fprintf(stderr, "\t\t3. encode : %s mode path width height\n", argv0);
-       fprintf(stderr, "\t\t4. mode : 0 - auto, 1 - decode from file, 2 - decode from memory, 3 - encode to file, 4 - encode to memeory\n");
+       fprintf(stderr, "\t\t4. mode : 0 - auto, 1 - decode from file, 2 - decode from memory, 3 - encode to file, 4 - encode to memory\n");
 }
 
 gboolean _get_arguments(int argc, char *argv[])
@@ -191,10 +191,6 @@ gboolean _get_arguments(int argc, char *argv[])
        }
 
        g_path = g_strdup(argv[2]);
-       if (g_path == NULL) {
-               fprintf(stderr, "\t[GIF_testsuite] Not enough memory\n");
-               return FALSE;
-       }
 
        if ((g_test_mode == TEST_AUTO) || (g_test_mode == TEST_DECODE_FILE) || (g_test_mode == TEST_DECODE_MEMORY)) {
                /* do nothing */
@@ -325,12 +321,8 @@ gboolean _test_auto()
        while (test_mode < TEST_NUM) {
                fprintf(stderr, "\t[GIF_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s\' TEST START\n", MODE_TO_STR[test_mode]);
                if (TEST_ENCODE_FILE == test_mode) {
-                       SAFE_G_FREE(g_path);
+                       g_free(g_path);
                        g_path = g_strdup(DECODE_FILE_PATH);
-                       if (g_path == NULL) {
-                               fprintf(stderr, "\t[GIF_testsuite] Not enough memory\n");
-                               return FALSE;
-                       }
                }
                /* test decoding gif */
                if ((test_mode == TEST_DECODE_FILE) || (test_mode == TEST_DECODE_MEMORY)) {
@@ -394,7 +386,7 @@ int main(int argc, char *argv[])
        }
 
 out:
-       SAFE_G_FREE(g_path);
+       g_free(g_path);
        SAFE_FREE(g_readed_data);
        SAFE_IMAGE_FREE(g_decoded_data);
 
index b7e0079..7f1b654 100644 (file)
@@ -190,11 +190,6 @@ gboolean _get_arguments(int argc, char *argv[])
        g_args.path = g_strdup(argv[index++]);
        g_args.cmd = g_strdup(argv[index++]);
 
-       if (!g_args.path || !g_args.cmd) {
-               fprintf(stderr, "\t[IMGP_testsuite] invalid path or command\n");
-               return FALSE;
-       }
-
        if (FALSE == _get_input_data(argv[index++], 0, UINT_MAX, &g_args.width)) {
                fprintf(stderr, "\t[IMGP_testsuite] wrong src_width %s\n", argv[index-1]);
                return FALSE;
@@ -356,8 +351,8 @@ TEST_FAIL:
        SAFE_IMAGE_FREE(_dst);
        IMGP_FREE(g_transformed.data);
        IMGP_FREE(g_args.data);
-       IMGP_FREE(g_args.cmd);
-       IMGP_FREE(g_args.path);
+       g_free(g_args.cmd);
+       g_free(g_args.path);
 
        return 0;
 }
index 14a295f..f0b92b0 100644 (file)
@@ -30,7 +30,6 @@
 #include <tzplatform_config.h>
 
 #define SAFE_FREE(x)           { if (x != NULL) { free(x); x = NULL; } }
-#define SAFE_G_FREE(x)         { if (x != NULL) { g_free(x); x = NULL; } }
 #define SAFE_IMAGE_FREE(x)     { if (x != NULL) { mm_image_destroy_image(x); x = NULL; } }
 
 #define DECODE_FILE_PATH       tzplatform_mkpath(TZ_USER_CONTENT, "jpeg_test_dec_file.raw")
@@ -180,7 +179,7 @@ void _print_help(const char *argv0)
        fprintf(stderr, "\t\t1. decode & encode : %s mode path color_format(opt.) quality(opt.) downscale(opt.)\n", argv0);
        fprintf(stderr, "\t\t2. decode : %s mode path color_format(opt.)\n", argv0);
        fprintf(stderr, "\t\t3. encode : %s mode path width(mand.) height(mand.) color_format(mand.) quality(opt.) downscale(opt.)\n", argv0);
-       fprintf(stderr, "\t\t4. mode : 0 - auto, 1 - decode from file, 2 - decode from memory, 3 - encode to file, 4 - encode to memeory\n");
+       fprintf(stderr, "\t\t4. mode : 0 - auto, 1 - decode from file, 2 - decode from memory, 3 - encode to file, 4 - encode to memory\n");
 }
 
 gboolean _get_arguments(int argc, char *argv[])
@@ -194,10 +193,6 @@ gboolean _get_arguments(int argc, char *argv[])
        }
 
        g_path = g_strdup(argv[2]);
-       if (g_path == NULL) {
-               fprintf(stderr, "\t[JPEG_testsuite] Not enough memory\n");
-               return FALSE;
-       }
 
        if (g_test_mode == TEST_AUTO) {
                if (FALSE == _get_input_data(argv[3], MM_UTIL_COLOR_YUV420, MM_UTIL_COLOR_NUM - 1, &g_color))
@@ -351,12 +346,8 @@ gboolean _test_auto()
        while (test_mode < TEST_NUM) {
                fprintf(stderr, "\t[JPEG_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s\' TEST START\n", MODE_TO_STR[test_mode]);
                if (TEST_ENCODE_FILE == test_mode) {
-                       SAFE_G_FREE(g_path);
+                       g_free(g_path);
                        g_path = g_strdup(DECODE_FILE_PATH);
-                       if (g_path == NULL) {
-                               fprintf(stderr, "\t[JPEG_testsuite] Not enough memory\n");
-                               return FALSE;
-                       }
                }
                /* test decoding jpeg */
                if ((test_mode == TEST_DECODE_FILE) || (test_mode == TEST_DECODE_MEMORY)) {
@@ -420,7 +411,7 @@ int main(int argc, char *argv[])
        }
 
 out:
-       SAFE_G_FREE(g_path);
+       g_free(g_path);
        SAFE_FREE(g_readed_data);
        SAFE_IMAGE_FREE(g_decoded_data);
 
index 2237307..a2b1823 100644 (file)
@@ -30,7 +30,6 @@
 #include <tzplatform_config.h>
 
 #define SAFE_FREE(x)           { if (x != NULL) { free(x); x = NULL; } }
-#define SAFE_G_FREE(x)         { if (x != NULL) { g_free(x); x = NULL; } }
 #define SAFE_IMAGE_FREE(x)     { if (x != NULL) { mm_image_destroy_image(x); x = NULL; } }
 
 #define DECODE_FILE_PATH       tzplatform_mkpath(TZ_USER_CONTENT, "png_test_dec_file.raw")
@@ -178,7 +177,7 @@ void _print_help(const char *argv0)
        fprintf(stderr, "\t\t1. decode & encode : %s mode path compression_level(opt.)\n", argv0);
        fprintf(stderr, "\t\t2. decode : %s mode path\n", argv0);
        fprintf(stderr, "\t\t3. encode : %s mode path width(mand.) height(mand.) compression_level(opt.)\n", argv0);
-       fprintf(stderr, "\t\t4. mode : 0 - auto, 1 - decode from file, 2 - decode from memory, 3 - encode to file, 4 - encode to memeory\n");
+       fprintf(stderr, "\t\t4. mode : 0 - auto, 1 - decode from file, 2 - decode from memory, 3 - encode to file, 4 - encode to memory\n");
 }
 
 gboolean _get_arguments(int argc, char *argv[])
@@ -192,10 +191,6 @@ gboolean _get_arguments(int argc, char *argv[])
        }
 
        g_path = g_strdup(argv[2]);
-       if (g_path == NULL) {
-               fprintf(stderr, "\t[PNG_testsuite] Not enough memory\n");
-               return FALSE;
-       }
 
        if (g_test_mode == TEST_AUTO) {
                if (FALSE == _get_input_data(argv[3], MM_UTIL_COMPRESSION_1, MM_UTIL_COMPRESSION_9, &g_compression))
@@ -332,12 +327,8 @@ gboolean _test_auto()
        while (test_mode < TEST_NUM) {
                fprintf(stderr, "\t[PNG_testsuite] >>>>>>>>>>>>>>>>>>>>>> \'%s\' TEST START\n", MODE_TO_STR[test_mode]);
                if (TEST_ENCODE_FILE == test_mode) {
-                       SAFE_G_FREE(g_path);
+                       g_free(g_path);
                        g_path = g_strdup(DECODE_FILE_PATH);
-                       if (g_path == NULL) {
-                               fprintf(stderr, "\t[PNG_testsuite] Not enough memory\n");
-                               return FALSE;
-                       }
                }
                /* test decoding png */
                if ((test_mode == TEST_DECODE_FILE) || (test_mode == TEST_DECODE_MEMORY)) {
@@ -401,7 +392,7 @@ int main(int argc, char *argv[])
        }
 
 out:
-       SAFE_G_FREE(g_path);
+       g_free(g_path);
        SAFE_FREE(g_readed_data);
        SAFE_IMAGE_FREE(g_decoded_data);