mirror of
https://github.com/nmap/nmap.git
synced 2025-12-19 05:59:01 +00:00
Code cleanup.
Removed unused nse.time_created field. Use bitfields instead of integers for nse.eof and nse.event_done Indentation fixes.
This commit is contained in:
@@ -146,12 +146,12 @@ int maximize_fdlimit(void) {
|
||||
|
||||
#if HAVE_SYS_UN_H
|
||||
/* Get the UNIX domain socket path or empty string if the address family != AF_UNIX. */
|
||||
const char *get_unixsock_path(const struct sockaddr_storage *addr)
|
||||
{
|
||||
const char *get_unixsock_path(const struct sockaddr_storage *addr) {
|
||||
struct sockaddr_un *su = (struct sockaddr_un *)addr;
|
||||
|
||||
if (!addr || addr->ss_family != AF_UNIX)
|
||||
return "";
|
||||
|
||||
struct sockaddr_un *su = (struct sockaddr_un *)addr;
|
||||
return (const char *)su->sun_path;
|
||||
}
|
||||
#endif
|
||||
@@ -160,8 +160,7 @@ const char *get_unixsock_path(const struct sockaddr_storage *addr)
|
||||
* In case we have support for UNIX domain sockets, function returns
|
||||
* string containing path to UNIX socket if the address family is AF_UNIX,
|
||||
* otherwise it returns string containing "<address>:<port>". */
|
||||
char *get_peeraddr_string(const msiod *iod)
|
||||
{
|
||||
char *get_peeraddr_string(const msiod *iod) {
|
||||
static char buffer[PEER_STR_LEN];
|
||||
|
||||
#if HAVE_SYS_UN_H
|
||||
|
||||
@@ -438,12 +438,12 @@ msevent *msevent_new(mspool *nsp, enum nse_type type, msiod *msiod, int timeout_
|
||||
nse->iod = msiod;
|
||||
nse->handler = handler;
|
||||
nse->userdata = userdata;
|
||||
nse->time_created = nsock_tod;
|
||||
|
||||
if (nse->iod == NULL)
|
||||
nsock_log_debug(nsp, "msevent_new (IOD #NULL) (EID #%li)", nse->id);
|
||||
else
|
||||
nsock_log_debug(nsp, "msevent_new (IOD #%li) (EID #%li)", nse->iod->id, nse->id);
|
||||
nsock_log_debug(nsp, "msevent_new (IOD #%li) (EID #%li)", nse->iod->id,
|
||||
nse->id);
|
||||
return nse;
|
||||
}
|
||||
|
||||
|
||||
@@ -312,7 +312,6 @@ typedef struct {
|
||||
/* nsock_event_t handles a single event. Its ID is generally returned when the
|
||||
* event is created, and the event is included in callbacks */
|
||||
typedef struct {
|
||||
|
||||
/* Every event has an ID which is unique for a given nsock unless you blow
|
||||
* through more than 500,000,000 events */
|
||||
nsock_event_id id;
|
||||
@@ -340,8 +339,6 @@ typedef struct {
|
||||
/* If we return a status of NSE_STATUS_ERROR, this must be set */
|
||||
int errnum;
|
||||
|
||||
int eof;
|
||||
|
||||
/* The nsock I/O descriptor related to event (if applicable) */
|
||||
msiod *iod;
|
||||
|
||||
@@ -355,9 +352,8 @@ typedef struct {
|
||||
* event_done is nonzero. Used when event is finished at unexpected time and
|
||||
* we want to dispatch it later to avoid duplicating stat update code and all
|
||||
* that other crap */
|
||||
int event_done;
|
||||
|
||||
struct timeval time_created;
|
||||
unsigned int event_done: 1;
|
||||
unsigned int eof: 1;
|
||||
} msevent;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user