mercurial/dirs.c
changeset 25016 42e89b87ca79
parent 25015 b3a68fb8b859
child 25092 f41539418b41
equal deleted inserted replaced
25015:b3a68fb8b859 25016:42e89b87ca79
    67 		PyString_AS_STRING(key)[pos] = '\0';
    67 		PyString_AS_STRING(key)[pos] = '\0';
    68 
    68 
    69 		val = PyDict_GetItem(dirs, key);
    69 		val = PyDict_GetItem(dirs, key);
    70 		if (val != NULL) {
    70 		if (val != NULL) {
    71 			PyInt_AS_LONG(val) += 1;
    71 			PyInt_AS_LONG(val) += 1;
    72 			continue;
    72 			break;
    73 		}
    73 		}
    74 
    74 
    75 		/* Force Python to not reuse a small shared int. */
    75 		/* Force Python to not reuse a small shared int. */
    76 		val = PyInt_FromLong(0x1eadbeef);
    76 		val = PyInt_FromLong(0x1eadbeef);
    77 
    77 
   112 			PyErr_SetString(PyExc_ValueError,
   112 			PyErr_SetString(PyExc_ValueError,
   113 					"expected a value, found none");
   113 					"expected a value, found none");
   114 			goto bail;
   114 			goto bail;
   115 		}
   115 		}
   116 
   116 
   117 		if (--PyInt_AS_LONG(val) <= 0 &&
   117 		if (--PyInt_AS_LONG(val) <= 0) {
   118 		    PyDict_DelItem(dirs, key) == -1)
   118 			if (PyDict_DelItem(dirs, key) == -1)
   119 			goto bail;
   119 				goto bail;
       
   120 		} else
       
   121 			break;
   120 		Py_CLEAR(key);
   122 		Py_CLEAR(key);
   121 	}
   123 	}
   122 	ret = 0;
   124 	ret = 0;
   123 
   125 
   124 bail:
   126 bail: