Mercurial > hg
comparison mercurial/cext/manifest.c @ 34440:7ed0750c71a1
cext: wrap before brace for functions
This is our prevailing style.
Differential Revision: https://phab.mercurial-scm.org/D910
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 02 Oct 2017 19:28:41 +0100 |
parents | b90e8da190da |
children | 6ece4a85c350 |
comparison
equal
deleted
inserted
replaced
34439:88e83a618de0 | 34440:7ed0750c71a1 |
---|---|
38 #define MANIFEST_OOM -1 | 38 #define MANIFEST_OOM -1 |
39 #define MANIFEST_NOT_SORTED -2 | 39 #define MANIFEST_NOT_SORTED -2 |
40 #define MANIFEST_MALFORMED -3 | 40 #define MANIFEST_MALFORMED -3 |
41 | 41 |
42 /* get the length of the path for a line */ | 42 /* get the length of the path for a line */ |
43 static size_t pathlen(line *l) { | 43 static size_t pathlen(line *l) |
44 { | |
44 return strlen(l->start); | 45 return strlen(l->start); |
45 } | 46 } |
46 | 47 |
47 /* get the node value of a single line */ | 48 /* get the node value of a single line */ |
48 static PyObject *nodeof(line *l) { | 49 static PyObject *nodeof(line *l) |
50 { | |
49 char *s = l->start; | 51 char *s = l->start; |
50 ssize_t llen = pathlen(l); | 52 ssize_t llen = pathlen(l); |
51 PyObject *hash = unhexlify(s + llen + 1, 40); | 53 PyObject *hash = unhexlify(s + llen + 1, 40); |
52 if (!hash) { | 54 if (!hash) { |
53 return NULL; | 55 return NULL; |
432 return 0; | 434 return 0; |
433 } | 435 } |
434 | 436 |
435 /* Do a binary search for the insertion point for new, creating the | 437 /* Do a binary search for the insertion point for new, creating the |
436 * new entry if needed. */ | 438 * new entry if needed. */ |
437 static int internalsetitem(lazymanifest *self, line *new) { | 439 static int internalsetitem(lazymanifest *self, line *new) |
440 { | |
438 int start = 0, end = self->numlines; | 441 int start = 0, end = self->numlines; |
439 while (start < end) { | 442 while (start < end) { |
440 int pos = start + (end - start) / 2; | 443 int pos = start + (end - start) / 2; |
441 int c = linecmp(new, self->lines + pos); | 444 int c = linecmp(new, self->lines + pos); |
442 if (c < 0) | 445 if (c < 0) |
600 | 603 |
601 /* Other methods (copy, diff, etc) */ | 604 /* Other methods (copy, diff, etc) */ |
602 static PyTypeObject lazymanifestType; | 605 static PyTypeObject lazymanifestType; |
603 | 606 |
604 /* If the manifest has changes, build the new manifest text and reindex it. */ | 607 /* If the manifest has changes, build the new manifest text and reindex it. */ |
605 static int compact(lazymanifest *self) { | 608 static int compact(lazymanifest *self) |
609 { | |
606 int i; | 610 int i; |
607 ssize_t need = 0; | 611 ssize_t need = 0; |
608 char *data; | 612 char *data; |
609 line *src, *dst; | 613 line *src, *dst; |
610 PyObject *pydata; | 614 PyObject *pydata; |