saxdb_reader_func_t *reader;
saxdb_writer_func_t *writer;
unsigned int write_interval;
- time_t last_write;
+ unsigned long last_write;
unsigned int last_write_duration;
struct saxdb *prev;
};
if (!data)
return;
if (db->writer == saxdb_mondo_writer) {
+ free_database(mondo_db);
mondo_db = data;
} else {
db->reader(data);
struct saxdb_context ctx;
char tmp_fname[MAXLEN];
int res, res2;
- time_t start, finish;
+ unsigned long start, finish;
assert(db->filename);
sprintf(tmp_fname, "%s.new", db->filename);
}
}
#else
-#define saxdb_pre_object(DEST)
+#define saxdb_pre_object(DEST)
#endif
static inline void
void
saxdb_write_int(struct saxdb_context *dest, const char *name, unsigned long value) {
- unsigned char buf[16];
+ char buf[16];
/* we could optimize this to take advantage of the fact that buf will never need escapes */
snprintf(buf, sizeof(buf), "%lu", value);
saxdb_write_string(dest, name, buf);
}
+void
+saxdb_write_sint(struct saxdb_context *dest, const char *name, long value) {
+ char buf[16];
+ /* we could optimize this to take advantage of the fact that buf will never need escapes */
+ snprintf(buf, sizeof(buf), "%ld", value);
+ saxdb_write_string(dest, name, buf);
+}
+
static void
saxdb_free(void *data) {
struct saxdb *db = data;
stop.tv_sec -= 1;
stop.tv_usec += 1000000;
}
- reply("MSG_DB_WROTE_DB", db->name, stop.tv_sec, stop.tv_usec);
+ reply("MSG_DB_WROTE_DB", db->name, (unsigned long)stop.tv_sec, (unsigned long)stop.tv_usec);
written++;
}
}
stop.tv_sec -= 1;
stop.tv_usec += 1000000;
}
- reply("MSG_DB_WROTE_ALL", stop.tv_sec, stop.tv_usec);
+ reply("MSG_DB_WROTE_ALL", (unsigned long)stop.tv_sec, (unsigned long)stop.tv_usec);
return 1;
}
tbl.contents[0][4] = "Last Duration";
for (ii=1, it=dict_first(saxdbs); it; it=iter_next(it), ++ii) {
struct saxdb *db = iter_data(it);
+ if (db->mondo_section) {
+ --ii;
+ continue;
+ }
char *buf = malloc(INTERVALLEN*3);
tbl.contents[ii] = calloc(tbl.width, sizeof(tbl.contents[ii][0]));
tbl.contents[ii][0] = db->name;
tbl.contents[ii][3] = buf+INTERVALLEN;
tbl.contents[ii][4] = buf+INTERVALLEN*2;
}
+ tbl.length = ii;
table_send(cmd->parent->bot, user->nick, 0, 0, tbl);
free(tbl.contents[0]);
for (ii=1; ii<tbl.length; ++ii) {