Patchwork parsers: remove unused getintat function

login
register
mail settings
Submitter Siddharth Agarwal
Date July 14, 2014, 10:44 p.m.
Message ID <e5d9cabd90ff5ecd8087.1405377887@dev1738.prn1.facebook.com>
Download mbox | patch
Permalink /patch/5164/
State Accepted
Commit 0feb41534421c40c23c71f89f292951b47c4fd98
Headers show

Comments

Siddharth Agarwal - July 14, 2014, 10:44 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1405377751 25200
#      Mon Jul 14 15:42:31 2014 -0700
# Node ID e5d9cabd90ff5ecd8087d348c3b3f80763650392
# Parent  2925ebabeb5d09641336f3b42a4cb4240d7f48c5
parsers: remove unused getintat function

Warning detected by clang.
Matt Mackall - July 14, 2014, 11:27 p.m.
On Mon, 2014-07-14 at 15:44 -0700, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0@fb.com>
> # Date 1405377751 25200
> #      Mon Jul 14 15:42:31 2014 -0700
> # Node ID e5d9cabd90ff5ecd8087d348c3b3f80763650392
> # Parent  2925ebabeb5d09641336f3b42a4cb4240d7f48c5
> parsers: remove unused getintat function

Queued for default, thanks.

Patch

diff --git a/mercurial/parsers.c b/mercurial/parsers.c
--- a/mercurial/parsers.c
+++ b/mercurial/parsers.c
@@ -342,30 +342,6 @@ 
 	return ret;
 }
 
-static inline int getintat(PyObject *tuple, int off, uint32_t *v)
-{
-	PyObject *o = PyTuple_GET_ITEM(tuple, off);
-	long val;
-
-	if (PyInt_Check(o))
-		val = PyInt_AS_LONG(o);
-	else if (PyLong_Check(o)) {
-		val = PyLong_AsLong(o);
-		if (val == -1 && PyErr_Occurred())
-			return -1;
-	} else {
-		PyErr_SetString(PyExc_TypeError, "expected an int or long");
-		return -1;
-	}
-	if (LONG_MAX > INT_MAX && (val > INT_MAX || val < INT_MIN)) {
-		PyErr_SetString(PyExc_OverflowError,
-				"Python value to large to convert to uint32_t");
-		return -1;
-	}
-	*v = (uint32_t)val;
-	return 0;
-}
-
 /*
  * Efficiently pack a dirstate object into its on-disk format.
  */