if (!h) {
/* Do slow and stack wasting realloc. The old sb->head is lost and
is freed eventually. */
- h = silc_smalloc_ua(stack, newsize);
+ h = (unsigned char *)silc_smalloc_ua(stack, newsize);
if (silc_unlikely(!h))
return NULL;
memcpy(h, sb->head, silc_buffer_truelen(sb));
if (*r++ == '\n') file->line++;
file->p = r;
}
+
/* Skips the current line until newline (lf or cr) */
static void my_skip_line(SilcConfigFile *file)
{
file->p = ((*r != '\0' && *r != EOF) ? r + 1 : r);
file->line++;
}
+
/* Obtains a text token from the current position until first separator.
* a separator is any non alphanumeric character nor "_" or "-" */
static char *my_next_token(SilcConfigFile *file, char *to)
file->p = o;
return to;
}
+
/* Obtains a string from the current position. The only difference from
* next_token() is that quoted-strings are also accepted */
static char *my_get_string(SilcConfigFile *file, char *to)
/* we don't need quote parsing, fall-back to token extractor */
my_next_token(file, to);
return to;
-};
+}
+
/* Skips all comment lines and spaces lines until first useful character */
static void my_skip_comments(SilcConfigFile *file)
{
}
return NULL;
}
+
/* Converts a string in the type specified. returns a dynamically
* allocated pointer. */
static void *silc_config_marshall(SilcConfigType type, const char *val)
ret = silc_calloc(1, sizeof(*ret));
ret->file = file;
return ret;
-};
+}
/* Returns the original filename of the object file */
task = (SilcTask)ttask;
} else if (silc_likely(type == SILC_TASK_FD)) {
+ SilcTaskFd ftask;
+
/* Check if fd is already added */
if (silc_unlikely(silc_hash_table_find(schedule->fd_queue,
SILC_32_TO_PTR(fd),
goto out;
}
- SilcTaskFd ftask = silc_calloc(1, sizeof(*ftask));
+ ftask = silc_calloc(1, sizeof(*ftask));
if (silc_unlikely(!ftask))
goto out;
* When this returns the program is to be ended. Before this function can
* be called, one must call silc_schedule_init function.
*
+ * NOTES
+ *
+ * On Windows this will block the program, but will continue dispatching
+ * window messages, and thus can be used as the main loop of the program.
+ *
+ * On Symbian this will return immediately. On Symbian calling
+ * silc_schedule is same as calling silc_schedule_one.
+ *
***/
void silc_schedule(SilcSchedule schedule);
* scheduler. The function will not return in this timeout unless
* some other event occurs.
*
+ * Typically this would be called from a timeout or idle task
+ * periodically (typically from 5-50 ms) to schedule SILC tasks. In
+ * this case the `timeout_usecs' is usually 0.
+ *
***/
SilcBool silc_schedule_one(SilcSchedule schedule, int timeout_usecs);
/* Check that `ptr' is last allocation */
sptr = (unsigned char *)stack->stack[si] +
SILC_STACK_ALIGN(sizeof(**stack->stack), SILC_STACK_DEFAULT_ALIGN);
- if (stack->stack[si]->bytes_left + old_size + (ptr - sptr) != bsize) {
+ if (stack->stack[si]->bytes_left + old_size +
+ ((unsigned char *)ptr - (unsigned char *)sptr) != bsize) {
SILC_LOG_DEBUG(("Cannot reallocate"));
SILC_STACK_STAT(stack, num_errors, 1);
return NULL;
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2005 Pekka Riikonen
+ Copyright (C) 2005 - 2006 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
void silc_stream_destroy(SilcStream stream)
{
SilcStreamHeader h = stream;
- return h->ops->destroy(stream);
+ h->ops->destroy(stream);
}
void silc_stream_set_notifier(SilcStream stream, SilcSchedule schedule,
SilcStreamNotifier notifier, void *context)
{
SilcStreamHeader h = stream;
- return h->ops->notifier(stream, schedule, notifier, context);
+ h->ops->notifier(stream, schedule, notifier, context);
}
SilcSchedule silc_stream_get_schedule(SilcStream stream)
#include "silc.h"
#include "silcstringprep.h"
-#include <stringprep.h>
+#include "stringprep.h"
/* We use GNU Libidn which has stringprep to do the magic. Only bad thing
is that its interface is idiotic. We have our own API here in case