- Adapted indenation to new agreed upon system

- Added support for second generation scriptcontext based counter
This commit is contained in:
koennecke
2009-02-13 09:00:03 +00:00
parent a3dcad2bfa
commit 91d4af0541
405 changed files with 88101 additions and 88173 deletions

View File

@@ -5,9 +5,10 @@
#include "errormsg.h"
/* compare two strings for euqality, ignoring text within square brackets */
int ErrEqual(char *str1, char *str2) {
int ErrEqual(char *str1, char *str2)
{
char *p;
while (*str1 != '\0' || *str2 != '\0') {
if (*str1 != *str2) {
return 0;
@@ -25,14 +26,15 @@ int ErrEqual(char *str1, char *str2) {
return 1;
}
ErrMsg *ErrPutMsg(ErrMsg *dump, char *fmt, ...) {
ErrMsg *ErrPutMsg(ErrMsg * dump, char *fmt, ...)
{
ErrMsg *m = NULL;
ErrMsg **last = NULL;
va_list ap;
char buf[256];
char *text = NULL;
int l;
va_start(ap, fmt);
l = vsnprintf(buf, sizeof buf, fmt, ap);
va_end(ap);
@@ -48,18 +50,20 @@ ErrMsg *ErrPutMsg(ErrMsg *dump, char *fmt, ...) {
last = &dump;
for (m = dump; m != NULL; m = m->next) {
if (ErrEqual(text, m->text)) {
*last = m->next; /* remove found item from list */
*last = m->next; /* remove found item from list */
break;
}
last = &m->next;
}
if (m == NULL) { /* make a new item */
if (text == buf) text = strdup(buf);
if (m == NULL) { /* make a new item */
if (text == buf)
text = strdup(buf);
m = calloc(1, sizeof(*m));
m->text = text;
m->cnt = 1;
} else {
if (text != buf) free(text);
if (text != buf)
free(text);
m->cnt++;
}
m->next = dump;