public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Marek Lindner <lindner_marek@yahoo.de>
To: The list for a Better Approach To Mobile Ad-hoc Networking
	<b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [B.A.T.M.A.N.] [PATCH] batman-adv: Move is_out_of_time() to main.c for general use
Date: Sat, 3 Dec 2011 15:36:26 +0800	[thread overview]
Message-ID: <201112031536.26477.lindner_marek@yahoo.de> (raw)
In-Reply-To: <1322836651-25134-1-git-send-email-martin@hundeboll.net>

On Friday, December 02, 2011 22:37:31 Martin Hundebøll wrote:
> Both translation tables and network coding use timeouts to do house
> keeping, so we might as well share the function used to compare a
> timestamp+timeout with current time.
> 
> Signed-off-by: Martin Hundebøll <martin@hundeboll.net>
> ---
>  main.c              |    5 +++++
>  main.h              |    1 +
>  translation-table.c |    8 --------
>  3 files changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/main.c b/main.c
> index 71b56cf..0930bb4 100644
> --- a/main.c
> +++ b/main.c
> @@ -172,6 +172,11 @@ int is_my_mac(const uint8_t *addr)
>         return 0;
>  }
>  
> +bool is_out_of_time(unsigned long timestamp, unsigned long timeout)
> +{
> +       return time_is_before_jiffies(timestamp +
> msecs_to_jiffies(timeout)); 
> +}

Since it is a simple one-liner you could make it a define or at least static 
inline (in main.h).

How about a more descriptive name like "reached_timeout()" or 
"has_timed_out()" ? We could use it in other parts of the code too.

You might also want to add a few words about the fact that you did not only 
move the function but also changed time_after() to time_is_before_jiffies() at 
the same time.

Regards,
Marek

  reply	other threads:[~2011-12-03  7:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-02 14:15 [B.A.T.M.A.N.] [PATCH] batman-adv: Move is_out_of_time() to main.c for general use Martin Hundebøll
2011-12-02 14:37 ` Martin Hundebøll
2011-12-03  7:36   ` Marek Lindner [this message]
2011-12-03 15:41     ` Martin Hundebøll
2011-12-03 15:46       ` Marek Lindner
2011-12-03 15:54         ` Martin Hundebøll
2011-12-08 12:32           ` [B.A.T.M.A.N.] [PATCHv2] batman-adv: Move is_out_of_time() to main.h " Martin Hundebøll
2011-12-10  9:28             ` Marek Lindner
2011-12-02 14:39 ` [B.A.T.M.A.N.] [PATCH] batman-adv: Rm trailing whitespace from is_my_mac() in main.c Martin Hundebøll
2011-12-03  7:27   ` Marek Lindner
2011-12-03 15:39     ` Martin Hundebøll
2011-12-08 11:48       ` [B.A.T.M.A.N.] [PATCHv2] batman-adv: Rm empty line " Martin Hundebøll
2011-12-10  9:18         ` Marek Lindner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201112031536.26477.lindner_marek@yahoo.de \
    --to=lindner_marek@yahoo.de \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox