Re: [PATCH v2 04/18] fsck: Offer a function to demote fsck errors to warnings

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH v2 04/18] fsck: Offer a function to demote fsck errors to warnings

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:03:38

Johannes Schindelin [off-list ref] writes:
+static inline int substrcmp(const char *string, int len, const char *match)
+{
+	int match_len = strlen(match);
+	if (match_len != len)
+		return -1;
+	return memcmp(string, match, len);
+}
Is this what we call "starts_with()" these days?
+void fsck_set_severity(struct fsck_options *options, const char *mode)
+{
+	int severity = FSCK_ERROR;
+
+	if (!options->msg_severity) {
+		int i;
+		int *msg_severity = malloc(sizeof(int) * FSCK_MSG_MAX);
xmalloc()?

Re: [PATCH v2 04/18] fsck: Offer a function to demote fsck errors to warnings

From: Johannes Schindelin <hidden>
Date: 2016-06-15 23:03:38

Hi Junio,

On 2015-01-21 09:49, Junio C Hamano wrote:
Johannes Schindelin [off-list ref] writes:
quoted
+static inline int substrcmp(const char *string, int len, const char *match)
+{
+	int match_len = strlen(match);
+	if (match_len != len)
+		return -1;
+	return memcmp(string, match, len);
+}
Is this what we call "starts_with()" these days?
Unfortunately not quite: It really requires the substring specified by `string` and `len` to be identical to the full `match`. For example, `substrcmp("Hello world!", 5, "Hell")` would report a failure (because the substring "Hello" is *not* matching "Hell"), while `starts_with("Hello world!", "Hell")` would obviously succeed.
quoted
+void fsck_set_severity(struct fsck_options *options, const char *mode)
+{
+	int severity = FSCK_ERROR;
+
+	if (!options->msg_severity) {
+		int i;
+		int *msg_severity = malloc(sizeof(int) * FSCK_MSG_MAX);
xmalloc()?
Absolutely! Fixed.

Thanks,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help