[PATCH 1 of 6] C modules: don't mix tabs and spaces

Nicolas Dumazet nicdumz at gmail.com
Thu Aug 27 08:09:10 CDT 2009


# HG changeset patch
# User Nicolas Dumazet <nicdumz.commits at gmail.com>
# Date 1251369425 -7200
# Node ID fdd0c8cdca78d000e76e895519abde0eeb0bbad1
# Parent  7345fa5e572e029362bc6f2f96af452607ebb1ff
C modules: don't mix tabs and spaces

Use tabs seems it is apparently the standard.

diff --git a/mercurial/bdiff.c b/mercurial/bdiff.c
--- a/mercurial/bdiff.c
+++ b/mercurial/bdiff.c
@@ -139,7 +139,7 @@
 	for (i = bn - 1; i >= 0; i--) {
 		/* find the equivalence class */
 		for (j = b[i].h & buckets; h[j].pos != INT_MAX;
-		     j = (j + 1) & buckets)
+			 j = (j + 1) & buckets)
 			if (!cmp(b + i, b + h[j].pos))
 				break;
 
@@ -157,7 +157,7 @@
 	for (i = 0; i < an; i++) {
 		/* find the equivalence class */
 		for (j = a[i].h & buckets; h[j].pos != INT_MAX;
-		     j = (j + 1) & buckets)
+			 j = (j + 1) & buckets)
 			if (!cmp(a + i, b + h[j].pos))
 				break;
 
@@ -209,10 +209,10 @@
 
 	/* expand match to include neighboring popular lines */
 	while (mi - mb > a1 && mj - mb > b1 &&
-	       a[mi - mb - 1].e == b[mj - mb - 1].e)
+		   a[mi - mb - 1].e == b[mj - mb - 1].e)
 		mb++;
 	while (mi + mk < a2 && mj + mk < b2 &&
-	       a[mi + mk].e == b[mj + mk].e)
+		   a[mi + mk].e == b[mj + mk].e)
 		mk++;
 
 	*omi = mi - mb;
@@ -222,7 +222,7 @@
 }
 
 static void recurse(struct line *a, struct line *b, struct pos *pos,
-		    int a1, int a2, int b1, int b2, struct hunklist *l)
+			int a1, int a2, int b1, int b2, struct hunklist *l)
 {
 	int i, j, k;
 
@@ -253,7 +253,7 @@
 	pos = (struct pos *)calloc(bn ? bn : 1, sizeof(struct pos));
 	/* we can't have more matches than lines in the shorter file */
 	l.head = l.base = (struct hunk *)malloc(sizeof(struct hunk) *
-	                                        ((an<bn ? an:bn) + 1));
+											((an<bn ? an:bn) + 1));
 
 	if (pos && l.base && t) {
 		/* generate the matching block list */
@@ -275,11 +275,11 @@
 
 		if (curr->a2 == next->a1)
 			while (curr->a2+shift < an && curr->b2+shift < bn
-			       && !cmp(a+curr->a2+shift, b+curr->b2+shift))
+				   && !cmp(a+curr->a2+shift, b+curr->b2+shift))
 				shift++;
 		else if (curr->b2 == next->b1)
 			while (curr->b2+shift < bn && curr->a2+shift < an
-			       && !cmp(b+curr->b2+shift, a+curr->a2+shift))
+				   && !cmp(b+curr->b2+shift, a+curr->a2+shift))
 				shift++;
 		if (!shift)
 			continue;
diff --git a/mercurial/diffhelpers.c b/mercurial/diffhelpers.c
--- a/mercurial/diffhelpers.c
+++ b/mercurial/diffhelpers.c
@@ -74,7 +74,7 @@
 		todob = lenb - PyList_Size(b);
 		num = todoa > todob ? todoa : todob;
 		if (num == 0)
-		    break;
+			break;
 		for (i = 0 ; i < num ; i++) {
 			x = PyFile_GetLine(fp, 0);
 			s = PyString_AS_STRING(x);
@@ -151,6 +151,6 @@
 {
 	Py_InitModule3("diffhelpers", methods, diffhelpers_doc);
 	diffhelpers_Error = PyErr_NewException("diffhelpers.diffhelpersError",
-	                                        NULL, NULL);
+											NULL, NULL);
 }
 
diff --git a/mercurial/mpatch.c b/mercurial/mpatch.c
--- a/mercurial/mpatch.c
+++ b/mercurial/mpatch.c
@@ -281,7 +281,7 @@
 		if (f->start < last || f->end > len) {
 			if (!PyErr_Occurred())
 				PyErr_SetString(mpatch_Error,
-				                "invalid patch");
+								"invalid patch");
 			return -1;
 		}
 		outlen += f->start - last;
@@ -304,7 +304,7 @@
 		if (f->start < last || f->end > len) {
 			if (!PyErr_Occurred())
 				PyErr_SetString(mpatch_Error,
-				                "invalid patch");
+								"invalid patch");
 			return 0;
 		}
 		memcpy(p, orig + last, f->start - last);
@@ -338,7 +338,7 @@
 	/* divide and conquer, memory management is elsewhere */
 	len = (end - start) / 2;
 	return combine(fold(bins, start, start + len),
-		       fold(bins, start + len, end));
+			   fold(bins, start + len, end));
 }
 
 static PyObject *
diff --git a/mercurial/osutil.c b/mercurial/osutil.c
--- a/mercurial/osutil.c
+++ b/mercurial/osutil.c
@@ -320,10 +320,10 @@
 		if (kind == -1 || keepstat) {
 #ifdef AT_SYMLINK_NOFOLLOW
 			err = fstatat(dfd, ent->d_name, &st,
-				      AT_SYMLINK_NOFOLLOW);
+					  AT_SYMLINK_NOFOLLOW);
 #else
 			strncpy(fullpath + pathlen + 1, ent->d_name,
-				PATH_MAX - pathlen);
+					PATH_MAX - pathlen);
 			fullpath[PATH_MAX] = 0;
 			err = lstat(fullpath, &st);
 #endif
@@ -332,7 +332,7 @@
 					PATH_MAX - pathlen);
 				fullpath[PATH_MAX] = 0;
 				PyErr_SetFromErrnoWithFilename(PyExc_OSError,
-							       fullpath);
+								   fullpath);
 				goto error;
 			}
 			kind = st.st_mode & S_IFMT;
@@ -467,18 +467,18 @@
 		break;
 	default:
 		PyErr_Format(PyExc_ValueError,
-			     "mode string must begin with one of 'r', 'w', "
-			     "or 'a', not '%c'", m0);
+				 "mode string must begin with one of 'r', 'w', "
+				 "or 'a', not '%c'", m0);
 		goto bail;
 	}
 
 	handle = CreateFile(name, access,
-			    FILE_SHARE_READ | FILE_SHARE_WRITE |
-			    FILE_SHARE_DELETE,
-			    NULL,
-			    creation,
-			    FILE_ATTRIBUTE_NORMAL,
-			    0);
+				FILE_SHARE_READ | FILE_SHARE_WRITE |
+				FILE_SHARE_DELETE,
+				NULL,
+				creation,
+				FILE_ATTRIBUTE_NORMAL,
+				0);
 
 	if (handle == INVALID_HANDLE_VALUE) {
 		PyErr_SetFromWindowsErrWithFilename(GetLastError(), name);
diff --git a/mercurial/parsers.c b/mercurial/parsers.c
--- a/mercurial/parsers.c
+++ b/mercurial/parsers.c
@@ -58,9 +58,9 @@
 	int len;
 
 	if (!PyArg_ParseTuple(args, "O!O!s#:parse_manifest",
-			      &PyDict_Type, &mfdict,
-			      &PyDict_Type, &fdict,
-			      &str, &len))
+				  &PyDict_Type, &mfdict,
+				  &PyDict_Type, &fdict,
+				  &str, &len))
 		goto quit;
 
 	for (start = cur = str, zero = NULL; cur < str + len; cur++) {
@@ -144,9 +144,9 @@
 static uint32_t ntohl(uint32_t x)
 {
 	return ((x & 0x000000ffUL) << 24) |
-	       ((x & 0x0000ff00UL) <<  8) |
-	       ((x & 0x00ff0000UL) >>  8) |
-	       ((x & 0xff000000UL) >> 24);
+		   ((x & 0x0000ff00UL) <<  8) |
+		   ((x & 0x00ff0000UL) >>  8) |
+		   ((x & 0xff000000UL) >> 24);
 }
 #else
 /* not windows */
@@ -170,9 +170,9 @@
 	char decode[16]; /* for alignment */
 
 	if (!PyArg_ParseTuple(args, "O!O!s#:parse_dirstate",
-			      &PyDict_Type, &dmap,
-			      &PyDict_Type, &cmap,
-			      &str, &len))
+				  &PyDict_Type, &dmap,
+				  &PyDict_Type, &cmap,
+				  &str, &len))
 		goto quit;
 
 	/* read parents */
@@ -212,14 +212,14 @@
 			cname = PyString_FromStringAndSize(cpos + 1,
 							   flen - (cpos - cur) - 1);
 			if (!fname || !cname ||
-			    PyDict_SetItem(cmap, fname, cname) == -1 ||
-			    PyDict_SetItem(dmap, fname, entry) == -1)
+				PyDict_SetItem(cmap, fname, cname) == -1 ||
+				PyDict_SetItem(dmap, fname, entry) == -1)
 				goto quit;
 			Py_DECREF(cname);
 		} else {
 			fname = PyString_FromStringAndSize(cur, flen);
 			if (!fname ||
-			    PyDict_SetItem(dmap, fname, entry) == -1)
+				PyDict_SetItem(dmap, fname, entry) == -1)
 				goto quit;
 		}
 		cur += flen;
@@ -243,9 +243,9 @@
 
 /* create an index tuple, insert into the nodemap */
 static PyObject * _build_idx_entry(PyObject *nodemap, int n, uint64_t offset_flags,
-                                   int comp_len, int uncomp_len, int base_rev,
-                                   int link_rev, int parent_1, int parent_2,
-                                   const char *c_node_id)
+								   int comp_len, int uncomp_len, int base_rev,
+								   int link_rev, int parent_1, int parent_2,
+								   const char *c_node_id)
 {
 	int err;
 	PyObject *entry, *node_id, *n_obj;
@@ -262,8 +262,8 @@
 		goto error_dealloc;
 
 	entry = Py_BuildValue("LiiiiiiN", offset_flags, comp_len,
-			      uncomp_len, base_rev, link_rev,
-			      parent_1, parent_2, node_id);
+				  uncomp_len, base_rev, link_rev,
+				  parent_1, parent_2, node_id);
 	if (!entry)
 		goto error_dealloc;
 	PyObject_GC_UnTrack(entry); /* don't waste time with this */
@@ -287,7 +287,7 @@
  *   32 bytes: nodeid (only 20 bytes used)
  */
 static int _parse_index_ng (const char *data, int size, int inlined,
-			    PyObject *index, PyObject *nodemap)
+				PyObject *index, PyObject *nodemap)
 {
 	PyObject *entry;
 	int n = 0, err;


More information about the Mercurial-devel mailing list