projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8f51718
)
use the regular template error logging for our new endconditional checker, so we...
author
Wilfried Goesgens
<dothebart@citadel.org>
Thu, 4 Aug 2011 20:52:11 +0000
(20:52 +0000)
committer
Wilfried Goesgens
<dothebart@citadel.org>
Sun, 4 Sep 2011 21:45:44 +0000
(21:45 +0000)
webcit/subst.c
patch
|
blob
|
history
diff --git
a/webcit/subst.c
b/webcit/subst.c
index 9a0be445f4f495be998a9a105fc09bb801fbcfb8..f9d2ab9691d2e3fbe023a2428926ab4c820da259 100644
(file)
--- a/
webcit/subst.c
+++ b/
webcit/subst.c
@@
-71,7
+71,7
@@
typedef struct _HashHandler {
WCHandlerFunc HandlerFunc;
}HashHandler;
WCHandlerFunc HandlerFunc;
}HashHandler;
-void *load_template(WCTemplate *NewTemplate);
+void *load_template(
StrBuf *Target,
WCTemplate *NewTemplate);
int EvaluateConditional(StrBuf *Target, int Neg, int state, WCTemplputParams *TP);
int EvaluateConditional(StrBuf *Target, int Neg, int state, WCTemplputParams *TP);
@@
-1194,7
+1194,7
@@
void *duplicate_template(WCTemplate *OldTemplate)
}
}
-void SanityCheckTemplate(WCTemplate *CheckMe)
+void SanityCheckTemplate(
StrBuf *Target,
WCTemplate *CheckMe)
{
int i = 0;
int j;
{
int i = 0;
int j;
@@
-1224,10
+1224,17
@@
void SanityCheckTemplate(WCTemplate *CheckMe)
}
if (!FoundConditionalEnd)
{
}
if (!FoundConditionalEnd)
{
- syslog(1, "ERROR: Conditional without Endconditional: '%s'\n",
- ChrPtr(CheckMe->Tokens[i]->FlatToken));
+ WCTemplputParams TP;
+ memset(&TP, 0, sizeof(WCTemplputParams));
+ TP.Tokens = CheckMe->Tokens[i];
+ LogTemplateError(
+ Target, "Token", ERR_PARM1, &TP,
+ "Conditional without Endconditional"
+ );
}
break;
}
break;
+ default:
+ break;
}
}
}
}
}
}
@@
-1236,7
+1243,7
@@
void SanityCheckTemplate(WCTemplate *CheckMe)
* \brief Display a variable-substituted template
* \param templatename template file to load
*/
* \brief Display a variable-substituted template
* \param templatename template file to load
*/
-void *load_template(WCTemplate *NewTemplate)
+void *load_template(
StrBuf *Target,
WCTemplate *NewTemplate)
{
int fd;
struct stat statbuf;
{
int fd;
struct stat statbuf;
@@
-1322,7
+1329,7
@@
void *load_template(WCTemplate *NewTemplate)
}
}
}
}
- SanityCheckTemplate(NewTemplate);
+ SanityCheckTemplate(N
ULL, N
ewTemplate);
return NewTemplate;
}
return NewTemplate;
}
@@
-1521,7
+1528,7
@@
void InitTemplateCache(void)
&vTemplate) &&
(vTemplate != NULL))
{
&vTemplate) &&
(vTemplate != NULL))
{
- load_template((WCTemplate *)vTemplate);
+ load_template(
NULL,
(WCTemplate *)vTemplate);
}
DeleteHashPos(&At);
}
}
DeleteHashPos(&At);
}
@@
-1640,7
+1647,7
@@
const StrBuf *ProcessTemplate(WCTemplate *Tmpl, StrBuf *Target, WCTemplputParams
syslog(1, "DBG: ----- loading: [%s] ------ \n",
ChrPtr(Tmpl->FileName));
pTmpl = duplicate_template(Tmpl);
syslog(1, "DBG: ----- loading: [%s] ------ \n",
ChrPtr(Tmpl->FileName));
pTmpl = duplicate_template(Tmpl);
- if(load_template(pTmpl) == NULL) {
+ if(load_template(
Target,
pTmpl) == NULL) {
StrBufAppendPrintf(
Target,
"<pre>\nError loading Template [%s]\n See Logfile for details\n</pre>\n",
StrBufAppendPrintf(
Target,
"<pre>\nError loading Template [%s]\n See Logfile for details\n</pre>\n",