[pacman-dev,3/5] libalpm: clarify alpm_download_event_completed_t status

Message ID 20201124123908.2096891-3-morganamilo@archlinux.org
State Accepted, archived
Headers show
Series [pacman-dev,1/5] libalpm: set parallel_downloads to 1 when creating the handle | expand

Commit Message

morganamilo Nov. 24, 2020, 12:39 p.m. UTC
The comment makes it seem that the result itself is an error code. But
all it does is simply return -1 to indicate an error occured;

Comments

Allan McRae Nov. 26, 2020, 11:07 a.m. UTC | #1
On 24/11/20 10:39 pm, morganamilo wrote:
> The comment makes it seem that the result itself is an error code. But
> all it does is simply return -1 to indicate an error occured;
> 
> diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
> index 614a530c..6a7323e0 100644
> --- a/lib/libalpm/alpm.h
> +++ b/lib/libalpm/alpm.h
> @@ -728,9 +728,9 @@ typedef struct {
>  	/* total bytes in file */
>  	off_t total;
>  	/* download result code:
> -	 *   0 - download completed successfully
> -	 *   1 - the file is up-to-date
> -	 *   negative - error code
> +	 *    0 - download completed successfully
> +	 *    1 - the file is up-to-date
> +	 *   -1 - error


I have a suspicion this was supposed to indicate "<0" as a failure, but
given we only use -1, this is fine.

>  	 */
>  	int result;
>  } alpm_download_event_completed_t;
>

Patch

diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 614a530c..6a7323e0 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -728,9 +728,9 @@  typedef struct {
 	/* total bytes in file */
 	off_t total;
 	/* download result code:
-	 *   0 - download completed successfully
-	 *   1 - the file is up-to-date
-	 *   negative - error code
+	 *    0 - download completed successfully
+	 *    1 - the file is up-to-date
+	 *   -1 - error
 	 */
 	int result;
 } alpm_download_event_completed_t;