Patchwork [1,of,5] mpatch: change Py_ssize_t to ssize_t in places that will be later copied

login
register
mail settings
Submitter Maciej Fijalkowski
Date July 25, 2016, 1:10 p.m.
Message ID <c6e9531e8de55ec73108.1469452255@brick.arcode.com>
Download mbox | patch
Permalink /patch/15979/
State Deferred
Headers show

Comments

Maciej Fijalkowski - July 25, 2016, 1:10 p.m.
# HG changeset patch
# User Maciej Fijalkowski <fijall@gmail.com>
# Date 1468847680 -7200
#      Mon Jul 18 15:14:40 2016 +0200
# Node ID c6e9531e8de55ec7310866e1aa452c4c914b8daa
# Parent  583ab8acdad3890153b34989241fd91d96a7a275
mpatch: change Py_ssize_t to ssize_t in places that will be later copied
Matt Mackall - July 25, 2016, 9:11 p.m.
On Mon, 2016-07-25 at 15:10 +0200, Maciej Fijalkowski wrote:
> # HG changeset patch
> # User Maciej Fijalkowski <fijall@gmail.com>
> # Date 1468847680 -7200
> #      Mon Jul 18 15:14:40 2016 +0200
> # Node ID c6e9531e8de55ec7310866e1aa452c4c914b8daa
> # Parent  583ab8acdad3890153b34989241fd91d96a7a275
> mpatch: change Py_ssize_t to ssize_t in places that will be later copied

Please hold these until Aug 1:

https://www.mercurial-scm.org/wiki/TimeBasedReleasePlan#Rules_for_code_freeze_an
d_stable_branch_commits

-- 
Mathematics is the supreme nostalgia of our time.

Patch

diff --git a/mercurial/mpatch.c b/mercurial/mpatch.c
--- a/mercurial/mpatch.c
+++ b/mercurial/mpatch.c
@@ -27,6 +27,7 @@ 
 
 #include "util.h"
 #include "bitmanipulation.h"
+#include "compat.h"
 
 static char mpatch_doc[] = "Efficient binary patching.";
 static PyObject *mpatch_Error;
@@ -40,7 +41,7 @@ 
 	struct frag *base, *head, *tail;
 };
 
-static struct flist *lalloc(Py_ssize_t size)
+static struct flist *lalloc(ssize_t size)
 {
 	struct flist *a = NULL;
 
@@ -70,7 +71,7 @@ 
 	}
 }
 
-static Py_ssize_t lsize(struct flist *a)
+static ssize_t lsize(struct flist *a)
 {
 	return a->tail - a->head;
 }
@@ -199,7 +200,7 @@ 
 }
 
 /* decode a binary patch into a hunk list */
-static struct flist *decode(const char *bin, Py_ssize_t len)
+static struct flist *decode(const char *bin, ssize_t len)
 {
 	struct flist *l;
 	struct frag *lt;
@@ -235,9 +236,9 @@ 
 }
 
 /* calculate the size of resultant text */
-static Py_ssize_t calcsize(Py_ssize_t len, struct flist *l)
+static ssize_t calcsize(ssize_t len, struct flist *l)
 {
-	Py_ssize_t outlen = 0, last = 0;
+	ssize_t outlen = 0, last = 0;
 	struct frag *f = l->head;
 
 	while (f != l->tail) {
@@ -257,7 +258,7 @@ 
 	return outlen;
 }
 
-static int apply(char *buf, const char *orig, Py_ssize_t len, struct flist *l)
+static int apply(char *buf, const char *orig, ssize_t len, struct flist *l)
 {
 	struct frag *f = l->head;
 	int last = 0;
@@ -282,9 +283,9 @@ 
 }
 
 /* recursively generate a patch of all bins between start and end */
-static struct flist *fold(PyObject *bins, Py_ssize_t start, Py_ssize_t end)
+static struct flist *fold(PyObject *bins, ssize_t start, ssize_t end)
 {
-	Py_ssize_t len, blen;
+	ssize_t len, blen;
 	const char *buffer;
 
 	if (start + 1 == end) {