Re: [PATCH v4 4/4] parse: separate out parsing functions from config.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jonathan

On 29/09/2023 22:20, Jonathan Tan wrote:
diff --git a/parse.h b/parse.h
new file mode 100644
index 0000000000..07d2193d69
--- /dev/null
+++ b/parse.h
@@ -0,0 +1,20 @@
+#ifndef PARSE_H
+#define PARSE_H
+
+int git_parse_signed(const char *value, intmax_t *ret, intmax_t max);

Previously this function was private to config.c, now it needs to be public because it is still called by git_config_get_expiry_date_in_days(). As this is essentially an internal helper for git_parse_int() and friends it is a bit unfortunate that it is now public. Perhaps we should change git_config_get_expiry_date_in_days() to call git_parse_int() instead. Then we can keep git_parse_signed() and git_parse_unsigned() private to parse.c.

+int git_parse_ssize_t(const char *, ssize_t *);
+int git_parse_ulong(const char *, unsigned long *);
+int git_parse_int(const char *value, int *ret);
+int git_parse_int64(const char *value, int64_t *ret);

This was previously private but I think it makes sense for it to be publicly available.

+/**
+ * Same as `git_config_bool`, except that it returns -1 on error rather
+ * than dying.
+ */
+int git_parse_maybe_bool(const char *);
+int git_parse_maybe_bool_text(const char *value);

This used to be private to config.c and now has callers in parse.c and config.c. We should make it clear that non-config code is likely to want git_parse_maybe_bool() rather than this function.

Best Wishes

Phillip



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux