summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2013-06-14 15:24:29 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2013-06-14 15:24:29 +0200
commit1fa71087c9d754b687d52059ee88ca82b45ec1eb (patch)
tree4c8fdb0b9f965cbe4f115dc1060fcbee7454ad0c
parent4e6799026291a9fd2627c060b00c128d3bbce405 (diff)
sfeed.c: remove some old debug code and entity translation code
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
-rw-r--r--sfeed.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/sfeed.c b/sfeed.c
index b156b30..e94e38f 100644
--- a/sfeed.c
+++ b/sfeed.c
@@ -387,20 +387,6 @@ string_print_trimmed(String *s) {
continue;
}
}
- /* TODO: not necesary anymore because xml_handler_data_entity is used with entitytostr ? */
- /* else if(*p == '&') {
- for(e = entities, i = 0, found = 0; *e; e += 2, i++) {
- len = entlen[i];
- if(!strncmp(*e, p, len)) {
- buffer[buflen++] = *(e + 1)[0];
- p += len;
- found = 1;
- break;
- }
- }
- if(found)
- continue;
- }*/
buffer[buflen++] = *p;
}
if(buflen >= BUFSIZ) {
@@ -409,10 +395,8 @@ string_print_trimmed(String *s) {
}
p++;
}
-/* printf("%d |", buflen);*/
if(buflen)
fwrite(buffer, 1, buflen, stdout);
-/* printf("|\n");*/
}
void /* print text, escape tabs, newline and carriage return etc */
@@ -552,11 +536,10 @@ xml_handler_start_element(XMLParser *p, const char *name, size_t namelen) {
/* iscontenttag = 0;*/
if(feeditem.feedtype != FeedTypeNone) { /* in item */
if(feeditemtag[0] == '\0') { /* set tag if not already set. */
-/* strncpy(feeditemtag, name, sizeof(feeditemtag) - 1);*/
- if(namelen >= sizeof(feeditemtag) - 2)
+ if(namelen >= sizeof(feeditemtag) - 2) /* check overflow */
return;
- memcpy(feeditemtag, name, namelen + 1);
- feeditemtaglen = namelen; /* XXX: assumes feeditemtag had enough space */
+ memcpy(feeditemtag, name, namelen + 1); /* copy including nul byte */
+ feeditemtaglen = namelen;
feeditemtagid = gettag(feeditem.feedtype, feeditemtag, feeditemtaglen);
if(feeditem.feedtype == FeedTypeRSS) {
@@ -642,7 +625,6 @@ xml_handler_end_element(XMLParser *p, const char *name, size_t namelen, int issh
char timebuf[64];
int tagid;
-/* printf("%d end tag: </%s>\n", iscontent, name);*/
if(iscontent) {
attrcount = 0;
/* TODO: optimize */