Browse Source

faux.log: faux_log_facility_id() returns bool_t instead int

Serj Kalichev 3 years ago
parent
commit
2e8a9e0eac
3 changed files with 7 additions and 7 deletions
  1. 1 1
      faux/log.h
  2. 5 5
      faux/log/log.c
  3. 1 1
      faux/log/testc_log.c

+ 1 - 1
faux/log.h

@@ -11,7 +11,7 @@
 
 C_DECL_BEGIN
 
-int faux_log_facility_id(const char *str, int *facility);
+bool_t faux_log_facility_id(const char *str, int *facility);
 const char *faux_log_facility_str(int facility_id);
 
 C_DECL_END

+ 5 - 5
faux/log/log.c

@@ -52,25 +52,25 @@ static struct log_name log_names[] = {
  *
  * @param [in] str Facility string.
  * @param [out] facility Facility in digital form.
- * @returns 0 - success, < 0 - parsing error
+ * @returns BOOL_TRUE - success, BOOL_FALSE - parsing error
  */
-int faux_log_facility_id(const char *str, int *facility)
+bool_t faux_log_facility_id(const char *str, int *facility)
 {
 	int i = 0;
 
 	assert(facility);
 	assert(str);
 	if (!str || !facility)
-		return -1;
+		return BOOL_FALSE;
 
 	for (i = 0; log_names[i].name; i++) {
 		if (faux_str_casecmp(str, log_names[i].name) == 0) {
 			*facility = log_names[i].facility;
-			return 0;
+			return BOOL_TRUE;
 		}
 	}
 
-	return -1;
+	return BOOL_FALSE;
 }
 
 /** @brief Returns syslog facility string by facility id.

+ 1 - 1
faux/log/testc_log.c

@@ -11,7 +11,7 @@ int testc_faux_log_facility_id(void)
 	int e = LOG_DAEMON;
 	int r = 0;
 
-	if (faux_log_facility_id(str, &r) < 0) {
+	if (!faux_log_facility_id(str, &r)) {
 		printf("Can't get id by string\n");
 		return -1;
 	}