"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Cheetah/c/_namemapper.c" between
cheetah3-3.2.5.tar.gz and cheetah3-3.2.6.tar.gz

About: Cheetah3 is a template engine and code generation tool for e.g. for Web development or Java, SQL, LaTeX, form email ... (written in Python).

_namemapper.c  (cheetah3-3.2.5):_namemapper.c  (cheetah3-3.2.6)
skipping to change at line 116 skipping to change at line 116
} }
static int getNameChunks(char *nameChunks[], char *name, char *nameCopy) static int getNameChunks(char *nameChunks[], char *name, char *nameCopy)
{ {
char c; char c;
char *currChunk; char *currChunk;
int currChunkNum = 0; int currChunkNum = 0;
currChunk = nameCopy; currChunk = nameCopy;
while ('\0' != (c = *nameCopy)){ while ('\0' != (c = *nameCopy)){
if ('.' == c) { if ('.' == c) {
if (currChunkNum >= (MAXCHUNKS-2)) { /* avoid overflowing nameChunks[] * if (currChunkNum >= (MAXCHUNKS-2)) { /* avoid overflowing nameChunks
/ [] */
PyErr_SetString(TooManyPeriods, name); PyErr_SetString(TooManyPeriods, name);
return 0; return 0;
} }
*nameCopy ='\0'; *nameCopy ='\0';
nameChunks[currChunkNum++] = currChunk; nameChunks[currChunkNum++] = currChunk;
nameCopy++; nameCopy++;
currChunk = nameCopy; currChunk = nameCopy;
} else } else
nameCopy++; nameCopy++;
} }
if (nameCopy > currChunk) { if (nameCopy > currChunk) {
nameChunks[currChunkNum++] = currChunk; nameChunks[currChunkNum++] = currChunk;
} }
return currChunkNum; return currChunkNum;
} }
static int PyNamemapper_hasKey(PyObject *obj, char *key) static int PyNamemapper_hasKey(PyObject *obj, char *key)
{ {
if (PyMapping_Check(obj) && PyMapping_HasKeyString(obj, key)) { if (PyMapping_Check(obj) && PyMapping_HasKeyString(obj, key)) {
skipping to change at line 263 skipping to change at line 263
PyObject *theValue; PyObject *theValue;
static char *kwlist[] = {"obj", "name", "executeCallables", NULL}; static char *kwlist[] = {"obj", "name", "executeCallables", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Os|i", kwlist, &obj, &name, &executeCallables)) { if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Os|i", kwlist, &obj, &name, &executeCallables)) {
return NULL; return NULL;
} }
createNameCopyAndChunks(); createNameCopyAndChunks();
theValue = PyNamemapper_valueForName(obj, nameChunks, numChunks, executeCall if (numChunks <= 0) {
ables); PyErr_SetString(PyExc_ValueError, "Invalid lookup of empty name");
free(nameCopy);
if (wrapInternalNotFoundException(name, obj)) {
theValue = NULL; theValue = NULL;
} else {
theValue = PyNamemapper_valueForName(obj, nameChunks, numChunks, execute
Callables);
if (wrapInternalNotFoundException(name, obj)) {
theValue = NULL;
}
} }
free(nameCopy);
return theValue; return theValue;
} }
static PyObject *namemapper_valueFromSearchList(PYARGS) static PyObject *namemapper_valueFromSearchList(PYARGS)
{ {
PyObject *searchList; PyObject *searchList;
char *name; char *name;
int executeCallables = 0; int executeCallables = 0;
char *nameCopy = NULL; char *nameCopy = NULL;
skipping to change at line 295 skipping to change at line 300
PyObject *iterator = NULL; PyObject *iterator = NULL;
static char *kwlist[] = {"searchList", "name", "executeCallables", NULL}; static char *kwlist[] = {"searchList", "name", "executeCallables", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Os|i", kwlist, &searchList, &name, &executeCallables)) { if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Os|i", kwlist, &searchList, &name, &executeCallables)) {
return NULL; return NULL;
} }
createNameCopyAndChunks(); createNameCopyAndChunks();
if (numChunks <= 0) {
PyErr_SetString(PyExc_ValueError, "Invalid lookup of empty name");
goto done;
}
iterator = PyObject_GetIter(searchList); iterator = PyObject_GetIter(searchList);
if (iterator == NULL) { if (iterator == NULL) {
PyErr_SetString(PyExc_TypeError,"This searchList is not iterable!"); PyErr_SetString(PyExc_TypeError,"This searchList is not iterable!");
goto done; goto done;
} }
while ((nameSpace = PyIter_Next(iterator))) { while ((nameSpace = PyIter_Next(iterator))) {
checkForNameInNameSpaceAndReturnIfFound(TRUE); checkForNameInNameSpaceAndReturnIfFound(TRUE);
Py_DECREF(nameSpace); Py_DECREF(nameSpace);
if(PyErr_CheckSignals()) { if(PyErr_CheckSignals()) {
skipping to change at line 350 skipping to change at line 360
static char *kwlist[] = {"searchList", "name", "executeCallables", NULL}; static char *kwlist[] = {"searchList", "name", "executeCallables", NULL};
if (!PyArg_ParseTupleAndKeywords(args, keywds, "Os|i", kwlist, &searchList, &name, if (!PyArg_ParseTupleAndKeywords(args, keywds, "Os|i", kwlist, &searchList, &name,
&executeCallables)) { &executeCallables)) {
return NULL; return NULL;
} }
createNameCopyAndChunks(); createNameCopyAndChunks();
if (numChunks <= 0) {
PyErr_SetString(PyExc_ValueError, "Invalid lookup of empty name");
goto done;
}
nameSpace = PyEval_GetLocals(); nameSpace = PyEval_GetLocals();
checkForNameInNameSpaceAndReturnIfFound(FALSE); checkForNameInNameSpaceAndReturnIfFound(FALSE);
iterator = PyObject_GetIter(searchList); iterator = PyObject_GetIter(searchList);
if (iterator == NULL) { if (iterator == NULL) {
PyErr_SetString(PyExc_TypeError,"This searchList is not iterable!"); PyErr_SetString(PyExc_TypeError,"This searchList is not iterable!");
goto done; goto done;
} }
while ( (nameSpace = PyIter_Next(iterator)) ) { while ( (nameSpace = PyIter_Next(iterator)) ) {
checkForNameInNameSpaceAndReturnIfFound(TRUE); checkForNameInNameSpaceAndReturnIfFound(TRUE);
skipping to change at line 413 skipping to change at line 428
PyObject *excString = NULL; PyObject *excString = NULL;
static char *kwlist[] = {"name", "executeCallables", NULL}; static char *kwlist[] = {"name", "executeCallables", NULL};
if (!PyArg_ParseTupleAndKeywords(args, keywds, "s|i", kwlist, &name, &execut eCallables)) { if (!PyArg_ParseTupleAndKeywords(args, keywds, "s|i", kwlist, &name, &execut eCallables)) {
return NULL; return NULL;
} }
createNameCopyAndChunks(); createNameCopyAndChunks();
if (numChunks <= 0) {
PyErr_SetString(PyExc_ValueError, "Invalid lookup of empty name");
goto done;
}
nameSpace = PyEval_GetLocals(); nameSpace = PyEval_GetLocals();
checkForNameInNameSpaceAndReturnIfFound(FALSE); checkForNameInNameSpaceAndReturnIfFound(FALSE);
nameSpace = PyEval_GetGlobals(); nameSpace = PyEval_GetGlobals();
checkForNameInNameSpaceAndReturnIfFound(FALSE); checkForNameInNameSpaceAndReturnIfFound(FALSE);
nameSpace = PyEval_GetBuiltins(); nameSpace = PyEval_GetBuiltins();
checkForNameInNameSpaceAndReturnIfFound(FALSE); checkForNameInNameSpaceAndReturnIfFound(FALSE);
excString = Py_BuildValue("s", "[locals(), globals(), __builtins__]"); excString = Py_BuildValue("s", "[locals(), globals(), __builtins__]");
 End of changes. 8 change blocks. 
16 lines changed or deleted 36 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)