Fixed alignment issues on 64-bit CPUs.
authorPekka Riikonen <priikone@silcnet.org>
Tue, 7 Aug 2007 18:15:19 +0000 (18:15 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Tue, 7 Aug 2007 18:15:19 +0000 (18:15 +0000)
lib/silcutil/silcschedule.c
lib/silcutil/unix/silcunixschedule.c

index 53cb0aa7426f22eb883c7fc5ee73fc427a9db48f..6c2f78ca840ed05982bcd56591f76b9809223f3a 100644 (file)
@@ -201,12 +201,12 @@ static void silc_schedule_task_remove(SilcSchedule schedule, SilcTask task)
   if (silc_unlikely(task == SILC_ALL_TASKS)) {
     SilcTask task;
     SilcHashTableList htl;
-    SilcUInt32 fd;
+    void *fd;
 
     /* Delete from fd queue */
     silc_hash_table_list(schedule->fd_queue, &htl);
-    while (silc_hash_table_get(&htl, (void *)&fd, (void *)&task))
-      silc_hash_table_del(schedule->fd_queue, SILC_32_TO_PTR(fd));
+    while (silc_hash_table_get(&htl, &fd, (void *)&task))
+      silc_hash_table_del(schedule->fd_queue, fd);
     silc_hash_table_list_reset(&htl);
 
     /* Delete from timeout queue */
index 137d52def8d784e8ddd55dc69f2fd6a661fe81b2..9aa2cdeb382624b07d1cf9c21d43cb108c476bd1 100644 (file)
@@ -121,11 +121,13 @@ int silc_poll(SilcSchedule schedule, void *context)
   struct pollfd *fds = internal->fds;
   SilcUInt32 fds_count = internal->fds_count;
   int fd, ret, i = 0, timeout = -1;
+  void *fdp;
 
   silc_hash_table_list(schedule->fd_queue, &htl);
-  while (silc_hash_table_get(&htl, (void *)&fd, (void *)&task)) {
+  while (silc_hash_table_get(&htl, &fdp, (void *)&task)) {
     if (!task->events)
       continue;
+    fd = SILC_PTR_TO_32(fdp);
 
     /* Allocate larger fd table if needed */
     if (i >= fds_count) {
@@ -198,14 +200,16 @@ int silc_select(SilcSchedule schedule, void *context)
   SilcTaskFd task;
   fd_set in, out;
   int fd, max_fd = 0, ret;
+  void *fdp;
 
   FD_ZERO(&in);
   FD_ZERO(&out);
 
   silc_hash_table_list(schedule->fd_queue, &htl);
-  while (silc_hash_table_get(&htl, (void *)&fd, (void *)&task)) {
+  while (silc_hash_table_get(&htl, &fdp, (void *)&task)) {
     if (!task->events)
       continue;
+    fd = SILC_PTR_TO_32(fdp);
 
 #ifdef FD_SETSIZE
     if (fd >= FD_SETSIZE)
@@ -233,9 +237,10 @@ int silc_select(SilcSchedule schedule, void *context)
     return ret;
 
   silc_hash_table_list(schedule->fd_queue, &htl);
-  while (silc_hash_table_get(&htl, (void *)&fd, (void *)&task)) {
+  while (silc_hash_table_get(&htl, &fdp, (void *)&task)) {
     if (!task->header.valid || !task->events)
       continue;
+    fd = SILC_PTR_TO_32(fdp);
 
 #ifdef FD_SETSIZE
     if (fd >= FD_SETSIZE)