aboutsummaryrefslogtreecommitdiffstats
path: root/read-cache.c
diff options
context:
space:
mode:
authorJeff Hostetler <jeffhost@microsoft.com>2017-04-14 19:12:28 +0000
committerJunio C Hamano <gitster@pobox.com>2017-04-15 02:21:12 -0700
commita6db3fbb6e4ec11695e2a3af8bc2cb9119cb1941 (patch)
tree6eeb1de45587403bee39e7579585c57409d1346c /read-cache.c
parentcf11a67975b057a144618badf16dc4e3d25b9407 (diff)
downloadgit-a6db3fbb6e4ec11695e2a3af8bc2cb9119cb1941.tar.gz
read-cache: add strcmp_offset function
Add strcmp_offset() function to also return the offset of the first change. Add unit test and helper to verify. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/read-cache.c b/read-cache.c
index e447751823..11823f5dbc 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -887,6 +887,26 @@ static int has_file_name(struct index_state *istate,
return retval;
}
+
+/*
+ * Like strcmp(), but also return the offset of the first change.
+ * If strings are equal, return the length.
+ */
+int strcmp_offset(const char *s1, const char *s2, size_t *first_change)
+{
+ size_t k;
+
+ if (!first_change)
+ return strcmp(s1, s2);
+
+ for (k = 0; s1[k] == s2[k]; k++)
+ if (s1[k] == '\0')
+ break;
+
+ *first_change = k;
+ return (unsigned char)s1[k] - (unsigned char)s2[k];
+}
+
/*
* Do we have another file with a pathname that is a proper
* subset of the name we're trying to add?
_release/core47-82-2'>chromeos-4.14__release/core47-82-2 Intel wireless group's fork of linux.gitIntel wireless group
aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSonny Rao <sonnyrao@chromium.org>2014-03-02 19:09:32 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-03-03 20:27:20 +0000
commit081081037f22d03f412efc076ee9ca0a78d8ff37 (patch)
tree29e5cbb8a93baceba01641875e04bdbd7c1d51de /arch
parent9d9fd0129401908a71972f28f6ea105c6a037623 (diff)
downloadchromeos-081081037f22d03f412efc076ee9ca0a78d8ff37.tar.gz
CHROMIUM: debug: register a watchpoint on the data being corrupted
Adds a kernel watchpoint to the task_migration_notifier.head where we've seen corruption. BUG=chromium:345917 TEST=`emerge-daisy chromeos-kernel-next` boots TEST=on device `dmesg|grep 'registering tmn watchpoint on'` finds message TEST=manual: load kernel module which writes to task_migration_notifier.head and observe crash Change-Id: I986b1d5320f10df1241401d8d635b7d7fcd5a5a2 Signed-off-by: Sonny Rao <sonnyrao@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/188479 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Doug Anderson <dianders@chromium.org>