* [PATCH] android/pan: Generate file path in compile time
@ 2014-01-13 9:08 Szymon Janc
2014-01-13 10:00 ` Szymon Janc
0 siblings, 1 reply; 2+ messages in thread
From: Szymon Janc @ 2014-01-13 9:08 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
This reduce need of using snprintf function and removes need of manual
buffer size calculation.
---
android/pan.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/android/pan.c b/android/pan.c
index 205da71..dfd7762 100644
--- a/android/pan.c
+++ b/android/pan.c
@@ -50,9 +50,9 @@
#include "bluetooth.h"
#define SVC_HINT_NETWORKING 0x02
-#define BNEP_BRIDGE "bnep"
-#define FORWARD_DELAY_PATH "/sys/class/net/%s/bridge/forward_delay"
-#define DELAY_PATH_MAX 41
+
+#define BNEP_BRIDGE "bnep"
+#define FORWARD_DELAY_PATH "/sys/class/net/"BNEP_BRIDGE"/bridge/forward_delay"
static bdaddr_t adapter_addr;
GSList *devices = NULL;
@@ -470,11 +470,8 @@ failed:
static int set_forward_delay(void)
{
int fd, ret;
- char path[DELAY_PATH_MAX];
-
- snprintf(path, sizeof(path), FORWARD_DELAY_PATH, BNEP_BRIDGE);
- fd = open(path, O_RDWR);
+ fd = open(FORWARD_DELAY_PATH, O_RDWR);
if (fd < 0)
return -errno;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] android/pan: Generate file path in compile time
2014-01-13 9:08 [PATCH] android/pan: Generate file path in compile time Szymon Janc
@ 2014-01-13 10:00 ` Szymon Janc
0 siblings, 0 replies; 2+ messages in thread
From: Szymon Janc @ 2014-01-13 10:00 UTC (permalink / raw)
To: linux-bluetooth
Hi,
On Monday 13 of January 2014 10:08:20 Szymon Janc wrote:
> This reduce need of using snprintf function and removes need of manual
> buffer size calculation.
> ---
> android/pan.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/android/pan.c b/android/pan.c
> index 205da71..dfd7762 100644
> --- a/android/pan.c
> +++ b/android/pan.c
> @@ -50,9 +50,9 @@
> #include "bluetooth.h"
>
> #define SVC_HINT_NETWORKING 0x02
> -#define BNEP_BRIDGE "bnep"
> -#define FORWARD_DELAY_PATH "/sys/class/net/%s/bridge/forward_delay"
> -#define DELAY_PATH_MAX 41
> +
> +#define BNEP_BRIDGE "bnep"
> +#define FORWARD_DELAY_PATH "/sys/class/net/"BNEP_BRIDGE"/bridge/forward_delay"
>
> static bdaddr_t adapter_addr;
> GSList *devices = NULL;
> @@ -470,11 +470,8 @@ failed:
> static int set_forward_delay(void)
> {
> int fd, ret;
> - char path[DELAY_PATH_MAX];
> -
> - snprintf(path, sizeof(path), FORWARD_DELAY_PATH, BNEP_BRIDGE);
>
> - fd = open(path, O_RDWR);
> + fd = open(FORWARD_DELAY_PATH, O_RDWR);
> if (fd < 0)
> return -errno;
>
This is now upstream.
--
Best regards,
Szymon Janc
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-01-13 10:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-13 9:08 [PATCH] android/pan: Generate file path in compile time Szymon Janc
2014-01-13 10:00 ` Szymon Janc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox