make unit of all temperatures selectable
[monky] / src / rss.c
index 222c41f..64222ab 100644 (file)
--- a/src/rss.c
+++ b/src/rss.c
@@ -7,7 +7,7 @@
  * Please see COPYING for details
  *
  * Copyright (c) 2007 Toni Spets
- * Copyright (c) 2005-2007 Brenden Matthews, Philip Kovacs, et. al.
+ * Copyright (c) 2005-2008 Brenden Matthews, Philip Kovacs, et. al.
  *     (see AUTHORS)
  * All rights reserved.
  *
  *
  * $Id$ */
 
-#include <stdio.h>
-#include <string.h>
+#include "conky.h"
+#include "prss.h"
 #include <time.h>
 #include <assert.h>
-#include "prss.h"
 #include <curl/curl.h>
 #include <curl/types.h>
 #include <curl/easy.h>
-#include "conky.h"
 
 #define MAX_FEEDS 16
 
@@ -65,7 +63,7 @@ size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
        return realsize;
 }
 
-int rss_delay(int *wait, int delay)
+int rss_delay(int *wait_time, int delay)
 {
        time_t now = time(NULL);
 
@@ -75,13 +73,13 @@ int rss_delay(int *wait, int delay)
        }
        delay *= 60;
 
-       if (!*wait) {
-               *wait = now + delay;
+       if (!*wait_time) {
+               *wait_time = now + delay;
                return 1;
        }
 
-       if (now >= *wait + delay) {
-               *wait = now + delay;
+       if (now >= *wait_time + delay) {
+               *wait_time = now + delay;
                return 1;
        }
 
@@ -115,12 +113,6 @@ PRSS *get_rss_info(char *uri, int delay)
        CURL *curl = NULL;
        CURLcode res;
 
-       // curl temps
-       struct MemoryStruct chunk;
-
-       chunk.memory = NULL;
-       chunk.size = 0;
-
        // pointers to struct
        feed *curfeed = NULL;
        PRSS *curdata = NULL;
@@ -128,6 +120,12 @@ PRSS *get_rss_info(char *uri, int delay)
 
        int i;
 
+       // curl temps
+       struct MemoryStruct chunk;
+
+       chunk.memory = NULL;
+       chunk.size = 0;
+
        // first seek for the uri in list
        for (i = 0; i < num_feeds; i++) {
                if (feeds[i].uri != NULL) {
@@ -143,7 +141,7 @@ PRSS *get_rss_info(char *uri, int delay)
                        return NULL;
                }
                curfeed = &feeds[num_feeds];
-               curfeed->uri = strdup(uri);
+               curfeed->uri = strndup(uri, text_buffer_size);
                num_feeds++;
        }