#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#define NUM_STD_BAUDRATES ARRAY_SIZE(std_baudrates)
-/* Helper functions for configuring ports. */
+/* Helper functions. */
+static int validate_port(struct sp_port *port);
+static struct sp_port **list_append(struct sp_port **list, const char *portname);
static int get_config(struct sp_port *port, struct sp_port_data *data, struct sp_port_config *config);
static int set_config(struct sp_port *port, struct sp_port_data *data, struct sp_port_config *config);
free(port);
}
-static struct sp_port **sp_list_append(struct sp_port **list, const char *portname)
+static struct sp_port **list_append(struct sp_port **list, const char *portname)
{
void *tmp;
unsigned int count;
#else
strcpy(name, data);
#endif
- if (type == REG_SZ && !(list = sp_list_append(list, name)))
+ if (type == REG_SZ && !(list = list_append(list, name)))
{
ret = SP_ERR_MEM;
goto out;
result = CFStringGetCString(cf_path,
path, PATH_MAX, kCFStringEncodingASCII);
CFRelease(cf_path);
- if (result && !(list = sp_list_append(list, path)))
+ if (result && !(list = list_append(list, path)))
{
ret = SP_ERR_MEM;
IOObjectRelease(port);
if (serial_info.type == PORT_UNKNOWN)
goto skip;
}
- list = sp_list_append(list, name);
+ list = list_append(list, name);
skip:
udev_device_unref(ud_dev);
if (!list)
free(list);
}
-static int sp_validate_port(struct sp_port *port)
+static int validate_port(struct sp_port *port)
{
if (port == NULL)
return 0;
return 1;
}
-#define CHECK_PORT() do { if (!sp_validate_port(port)) return SP_ERR_ARG; } while (0)
+#define CHECK_PORT() do { if (!validate_port(port)) return SP_ERR_ARG; } while (0)
int sp_open(struct sp_port *port, int flags)
{