# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1431119460 25200
#      Fri May 08 14:11:00 2015 -0700
# Node ID f41539418b413b5aec512aa3fcf48996a39e81ac
# Parent  b5052fc73300faf5c6f2146dee68d8d4f82a0f6c
dirs.c: extract 'cpath' variable in _delpath() to match _addpath()

The PyString_AS_STRING() macro is probably free, but this makes
_delpath() more similar to _addpath() and simplifies the next patch.

diff --git a/mercurial/dirs.c b/mercurial/dirs.c
--- a/mercurial/dirs.c
+++ b/mercurial/dirs.c
@@ -95,6 +95,7 @@
 
 static int _delpath(PyObject *dirs, PyObject *path)
 {
+	char *cpath = PyString_AS_STRING(path);
 	Py_ssize_t pos = PyString_GET_SIZE(path);
 	PyObject *key = NULL;
 	int ret = -1;
@@ -102,7 +103,7 @@
 	while ((pos = _finddir(path, pos - 1)) != -1) {
 		PyObject *val;
 
-		key = PyString_FromStringAndSize(PyString_AS_STRING(path), pos);
+		key = PyString_FromStringAndSize(cpath, pos);
 
 		if (key == NULL)
 			goto bail;