[08/13] avio: change avio_tell/skip from macros to inline functions

Message ID 1300131546-2880-8-git-send-email-anton@khirnov.net
State Committed
Commit af02073225e5b34a8ea72bd3ff531868ed0b5061
Headers show

Commit Message

Anton Khirnov March 14, 2011, 7:39 p.m.
---
 libavformat/avio.h |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

Comments

Ronald Bultje March 17, 2011, 2:42 a.m. | #1
Hi,

On Mon, Mar 14, 2011 at 3:39 PM, Anton Khirnov <anton@khirnov.net> wrote:
> ---
>  libavformat/avio.h |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/avio.h b/libavformat/avio.h
> index 2db72be..b1001fe 100644
> --- a/libavformat/avio.h
> +++ b/libavformat/avio.h
> @@ -502,13 +502,19 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence);
>  * Skip given number of bytes forward
>  * @return new position or AVERROR.
>  */
> -#define avio_skip(s, offset) avio_seek(s, offset, SEEK_CUR)
> +static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
> +{
> +    return avio_seek(s, offset, SEEK_CUR);
> +}
>
>  /**
>  * ftell() equivalent for AVIOContext.
>  * @return position or AVERROR.
>  */
> -#define avio_tell(s) avio_seek((s), 0, SEEK_CUR)
> +static av_always_inline int64_t avio_tell(AVIOContext *s)
> +{
> +    return avio_seek(s, 0, SEEK_CUR);
> +}
>
>  /**
>  * Get the filesize.
> --
> 1.7.4.1

As you wish, queued.

Ronald

Patch

diff --git a/libavformat/avio.h b/libavformat/avio.h
index 2db72be..b1001fe 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -502,13 +502,19 @@  int64_t avio_seek(AVIOContext *s, int64_t offset, int whence);
  * Skip given number of bytes forward
  * @return new position or AVERROR.
  */
-#define avio_skip(s, offset) avio_seek(s, offset, SEEK_CUR)
+static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
+{
+    return avio_seek(s, offset, SEEK_CUR);
+}
 
 /**
  * ftell() equivalent for AVIOContext.
  * @return position or AVERROR.
  */
-#define avio_tell(s) avio_seek((s), 0, SEEK_CUR)
+static av_always_inline int64_t avio_tell(AVIOContext *s)
+{
+    return avio_seek(s, 0, SEEK_CUR);
+}
 
 /**
  * Get the filesize.