* [PATCH] block: rbd.c: Remove unused function
@ 2015-01-01 16:58 Rickard Strandqvist
2015-01-05 9:25 ` Ilya Dryomov
0 siblings, 1 reply; 2+ messages in thread
From: Rickard Strandqvist @ 2015-01-01 16:58 UTC (permalink / raw)
To: Yehuda Sadeh, Sage Weil
Cc: Rickard Strandqvist, Alex Elder, ceph-devel, linux-kernel
Remove the function copy_token() that is not used anywhere.
This was partially found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
drivers/block/rbd.c | 30 ------------------------------
1 file changed, 30 deletions(-)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 27b71a0..922f1ab 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -4776,36 +4776,6 @@ static inline size_t next_token(const char **buf)
}
/*
- * Finds the next token in *buf, and if the provided token buffer is
- * big enough, copies the found token into it. The result, if
- * copied, is guaranteed to be terminated with '\0'. Note that *buf
- * must be terminated with '\0' on entry.
- *
- * Returns the length of the token found (not including the '\0').
- * Return value will be 0 if no token is found, and it will be >=
- * token_size if the token would not fit.
- *
- * The *buf pointer will be updated to point beyond the end of the
- * found token. Note that this occurs even if the token buffer is
- * too small to hold it.
- */
-static inline size_t copy_token(const char **buf,
- char *token,
- size_t token_size)
-{
- size_t len;
-
- len = next_token(buf);
- if (len < token_size) {
- memcpy(token, *buf, len);
- *(token + len) = '\0';
- }
- *buf += len;
-
- return len;
-}
-
-/*
* Finds the next token in *buf, dynamically allocates a buffer big
* enough to hold a copy of it, and copies the token into the new
* buffer. The copy is guaranteed to be terminated with '\0'. Note
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] block: rbd.c: Remove unused function
2015-01-01 16:58 [PATCH] block: rbd.c: Remove unused function Rickard Strandqvist
@ 2015-01-05 9:25 ` Ilya Dryomov
0 siblings, 0 replies; 2+ messages in thread
From: Ilya Dryomov @ 2015-01-05 9:25 UTC (permalink / raw)
To: Rickard Strandqvist
Cc: Yehuda Sadeh, Sage Weil, Alex Elder, Ceph Development,
Linux Kernel Mailing List
On Thu, Jan 1, 2015 at 7:58 PM, Rickard Strandqvist
<rickard_strandqvist@spectrumdigital.se> wrote:
> Remove the function copy_token() that is not used anywhere.
>
> This was partially found by using a static code analysis program called cppcheck.
>
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> ---
> drivers/block/rbd.c | 30 ------------------------------
> 1 file changed, 30 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 27b71a0..922f1ab 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -4776,36 +4776,6 @@ static inline size_t next_token(const char **buf)
> }
>
> /*
> - * Finds the next token in *buf, and if the provided token buffer is
> - * big enough, copies the found token into it. The result, if
> - * copied, is guaranteed to be terminated with '\0'. Note that *buf
> - * must be terminated with '\0' on entry.
> - *
> - * Returns the length of the token found (not including the '\0').
> - * Return value will be 0 if no token is found, and it will be >=
> - * token_size if the token would not fit.
> - *
> - * The *buf pointer will be updated to point beyond the end of the
> - * found token. Note that this occurs even if the token buffer is
> - * too small to hold it.
> - */
> -static inline size_t copy_token(const char **buf,
> - char *token,
> - size_t token_size)
> -{
> - size_t len;
> -
> - len = next_token(buf);
> - if (len < token_size) {
> - memcpy(token, *buf, len);
> - *(token + len) = '\0';
> - }
> - *buf += len;
> -
> - return len;
> -}
> -
> -/*
> * Finds the next token in *buf, dynamically allocates a buffer big
> * enough to hold a copy of it, and copies the token into the new
> * buffer. The copy is guaranteed to be terminated with '\0'. Note
Applied with an amended changelog.
Thanks,
Ilya
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-05 9:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-01 16:58 [PATCH] block: rbd.c: Remove unused function Rickard Strandqvist
2015-01-05 9:25 ` Ilya Dryomov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).