diff mbox series

Replace int with enum in check_if_required

Message ID 20210116134551.143991-1-sbabic@denx.de
State Accepted
Headers show
Series Replace int with enum in check_if_required | expand

Commit Message

Stefano Babic Jan. 16, 2021, 1:45 p.m. UTC
There is already an enum, so replace the generic int return and use the
enumeration.

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 core/installer.c        | 4 ++--
 core/stream_interface.c | 2 +-
 include/installer.h     | 2 +-
 include/swupdate.h      | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/core/installer.c b/core/installer.c
index d830dae..a324f1b 100644
--- a/core/installer.c
+++ b/core/installer.c
@@ -41,11 +41,11 @@ 
  * 2 = install directly (stream to the handler)
  * -1= error found
  */
-int check_if_required(struct imglist *list, struct filehdr *pfdh,
+swupdate_file_t check_if_required(struct imglist *list, struct filehdr *pfdh,
 				const char *destdir,
 				struct img_type **pimg)
 {
-	int skip = SKIP_FILE;
+	swupdate_file_t skip = SKIP_FILE;
 	struct img_type *img;
 
 	/*
diff --git a/core/stream_interface.c b/core/stream_interface.c
index aef6a86..0205866 100644
--- a/core/stream_interface.c
+++ b/core/stream_interface.c
@@ -122,7 +122,7 @@  static int extract_files(int fd, struct swupdate_cfg *software)
 	int status = STREAM_WAIT_DESCRIPTION;
 	unsigned long offset;
 	struct filehdr fdh;
-	int skip;
+	swupdate_file_t skip;
 	uint32_t checksum;
 	int fdout;
 	struct img_type *img, *part;
diff --git a/include/installer.h b/include/installer.h
index 9fe5f2b..f69a94f 100644
--- a/include/installer.h
+++ b/include/installer.h
@@ -14,7 +14,7 @@ 
 #include "handler.h"
 #include "cpiohdr.h"
 
-int check_if_required(struct imglist *list, struct filehdr *pfdh,
+swupdate_file_t check_if_required(struct imglist *list, struct filehdr *pfdh,
 				const char *destdir,
 				struct img_type **pimg);
 int install_images(struct swupdate_cfg *sw);
diff --git a/include/swupdate.h b/include/swupdate.h
index a687927..137d8f2 100644
--- a/include/swupdate.h
+++ b/include/swupdate.h
@@ -35,11 +35,11 @@  typedef enum {
  * in the .swu image is required for the
  * device, or can be skipped
  */
-enum {
+typedef enum {
 	COPY_FILE,
 	SKIP_FILE,
 	INSTALL_FROM_STREAM
-};
+} swupdate_file_t;
 
 typedef enum {
 	SKIP_NONE=0,