Skip to content

Commit

Permalink
Move iio_create_network_context() to compat lib
Browse files Browse the repository at this point in the history
Simplify the main library API by moving old deprecated symbols into the
compat library.

Signed-off-by: Paul Cercueil <[email protected]>
  • Loading branch information
pcercuei committed Jun 10, 2021
1 parent e26a1fa commit d646dd3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 22 deletions.
5 changes: 5 additions & 0 deletions compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ struct iio_context * iio_create_xml_context(const char *xml_file)
return create_context_with_arg("xml:", xml_file);
}

struct iio_context * iio_create_network_context(const char *hostname)
{
return create_context_with_arg("ip:", hostname);
}

struct iio_context * iio_create_local_context(void)
{
return iio_create_context_from_uri("local:");
Expand Down
15 changes: 0 additions & 15 deletions context.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,21 +464,6 @@ struct iio_context * iio_create_default_context(void)
return iio_create_context_from_uri("local:");
}

static struct iio_context *
iio_create_context_from_uri_arg(const char *backend, const char *arg)
{
char uri[1024];

iio_snprintf(uri, sizeof(uri), "%s:%s", backend, arg);

return iio_create_context_from_uri(uri);
}

struct iio_context * iio_create_network_context(const char *hostname)
{
return iio_create_context_from_uri_arg("ip", hostname);
}

struct iio_context * iio_create_xml_context_mem(const char *xml, size_t len)
{
if (WITH_XML_BACKEND)
Expand Down
7 changes: 7 additions & 0 deletions iio-compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@
__api __check_ret struct iio_context * iio_create_local_context(void);


/** @brief Create a context from the network
* @param host Hostname, IPv4 or IPv6 address where the IIO Daemon is running
* @return On success, a pointer to an iio_context structure
* @return On failure, NULL is returned and errno is set appropriately */
__api __check_ret struct iio_context * iio_create_network_context(const char *host);


/** @brief Create a context from a XML file
* @param xml_file Path to the XML file to open
* @return On success, A pointer to an iio_context structure
Expand Down
7 changes: 0 additions & 7 deletions iio.h
Original file line number Diff line number Diff line change
Expand Up @@ -429,13 +429,6 @@ __api __check_ret struct iio_context * iio_create_xml_context_mem(
const char *xml, size_t len);


/** @brief Create a context from the network
* @param host Hostname, IPv4 or IPv6 address where the IIO Daemon is running
* @return On success, a pointer to an iio_context structure
* @return On failure, NULL is returned and errno is set appropriately */
__api __check_ret struct iio_context * iio_create_network_context(const char *host);


/** @brief Create a context from a URI description
* @param uri A URI describing the context location
* @return On success, a pointer to a iio_context structure
Expand Down

0 comments on commit d646dd3

Please sign in to comment.