Mercurial > dropbear
comparison listener.c @ 1460:58a74cb829b8
Pointer parameter could be declared as pointing to const (callback)
author | Francois Perrad <francois.perrad@gadz.org> |
---|---|
date | Sat, 19 Aug 2017 22:39:53 +0200 |
parents | 06d52bcb8094 |
children | ce3ce75a6e04 |
comparison
equal
deleted
inserted
replaced
1459:06d52bcb8094 | 1460:58a74cb829b8 |
---|---|
76 | 76 |
77 /* acceptor(int fd, void* typedata) is a function to accept connections, | 77 /* acceptor(int fd, void* typedata) is a function to accept connections, |
78 * cleanup(void* typedata) happens when cleaning up */ | 78 * cleanup(void* typedata) happens when cleaning up */ |
79 struct Listener* new_listener(const int socks[], unsigned int nsocks, | 79 struct Listener* new_listener(const int socks[], unsigned int nsocks, |
80 int type, void* typedata, | 80 int type, void* typedata, |
81 void (*acceptor)(struct Listener* listener, int sock), | 81 void (*acceptor)(const struct Listener* listener, int sock), |
82 void (*cleanup)(struct Listener*)) { | 82 void (*cleanup)(const struct Listener*)) { |
83 | 83 |
84 unsigned int i, j; | 84 unsigned int i, j; |
85 struct Listener *newlisten = NULL; | 85 struct Listener *newlisten = NULL; |
86 /* try get a new structure to hold it */ | 86 /* try get a new structure to hold it */ |
87 for (i = 0; i < ses.listensize; i++) { | 87 for (i = 0; i < ses.listensize; i++) { |
130 return newlisten; | 130 return newlisten; |
131 } | 131 } |
132 | 132 |
133 /* Return the first listener which matches the type-specific comparison | 133 /* Return the first listener which matches the type-specific comparison |
134 * function. Particularly needed for global requests, like tcp */ | 134 * function. Particularly needed for global requests, like tcp */ |
135 struct Listener * get_listener(int type, void* typedata, | 135 struct Listener * get_listener(int type, const void* typedata, |
136 int (*match)(void*, void*)) { | 136 int (*match)(const void*, const void*)) { |
137 | 137 |
138 unsigned int i; | 138 unsigned int i; |
139 struct Listener* listener; | 139 struct Listener* listener; |
140 | 140 |
141 for (i = 0, listener = ses.listeners[i]; i < ses.listensize; i++) { | 141 for (i = 0, listener = ses.listeners[i]; i < ses.listensize; i++) { |