+/**
+ * \file
+ */
+
#include "config.h"
#include "utils/mono-networkinterfaces.h"
/**
* mono_networkinterface_list:
- * @size: a pointer to a location where the size of the returned array is stored
- *
- * Return an array of names for the interfaces currently on the system.
- * The size of the array is stored in @size.
+ * \param size a pointer to a location where the size of the returned array is stored
+ * \returns an array of names for the interfaces currently on the system.
+ * The size of the array is stored in \p size.
*/
gpointer*
mono_networkinterface_list (int *size)
count *= 2;
}
- nilist = g_realloc (nilist, count * sizeof (void*));
+ nilist = (void **) g_realloc (nilist, count * sizeof (void*));
nilist [i++] = g_strdup (name);
}
if (size)
*size = i;
+ if (!nilist)
+ nilist = (void **) g_malloc (sizeof (void*));
nilist [i] = NULL;
return nilist;
}
/**
* mono_network_get_data:
- * @name: name of the interface
- * @data: description of data to return
- *
- * Return a data item of a network adapter like bytes sent per sec, etc
- * according to the @data argumet.
+ * \param name name of the interface
+ * \param data description of data to return
+ * \return a data item of a network adapter like bytes sent per sec, etc
+ * according to the \p data argumet.
*/
gint64
mono_network_get_data (char* name, MonoNetworkData data, MonoNetworkError *error)
rx_fifo, rx_frame, tx_bytes, tx_packets, tx_errs, tx_drops,
tx_fifo, tx_colls, tx_carrier, rx_multi;
- if (error)
- *error = MONO_NETWORK_ERROR_OTHER;
+ *error = MONO_NETWORK_ERROR_OTHER;
f = fopen ("/proc/net/dev", "r");
if (!f)
char *ptr;
buf [sizeof (buf) - 1] = 0;
if ((ptr = strchr (buf, ':')) == NULL ||
- (*ptr++ = 0, sscanf (buf, "%s", cname) != 1))
+ (*ptr++ = 0, sscanf (buf, "%250s", cname) != 1))
goto out;
if (strcmp (name, cname) != 0) continue;