#include "util.h"
#include "globals.h"
+#ifdef WINDOWS
+#include <windows.h>
+#else
+#include <unistd.h>
+#endif
+
+guint util_get_number_of_cpus ()
+{
+#if GLIB_CHECK_VERSION (2, 36, 0)
+ return g_get_num_processors();
+#else
+ long nprocs = 1;
+#ifdef WINDOWS
+ SYSTEM_INFO info;
+ GetSystemInfo(&info);
+ nprocs = info.dwNumberOfProcessors;
+#else
+#ifdef _SC_NPROCESSORS_ONLN
+ nprocs = sysconf(_SC_NPROCESSORS_ONLN);
+ if (nprocs < 1)
+ nprocs = 1;
+#endif
+#endif
+ return nprocs;
+#endif
+}
+
gchar *uri_escape(gchar *str)
{
gchar *esc_str = g_malloc(3*strlen(str));
// Remove newline from val and also any other whitespace
*key = g_strstrip ( *key );
*val = g_strstrip ( *val );
-
return TRUE;
}
G_BEGIN_DECLS
+guint util_get_number_of_cpus (void);
+
gchar *uri_escape(gchar *str);
GList * str_array_to_glist(gchar* data[]);