All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/41] use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
@ 2022-03-21 22:54 Elia Pinto
  2022-03-21 22:54 ` [PATCH 01/41] archive.c: " Elia Pinto
                   ` (42 more replies)
  0 siblings, 43 replies; 48+ messages in thread
From: Elia Pinto @ 2022-03-21 22:54 UTC (permalink / raw)
  To: git; +Cc: Elia Pinto

The C standard specifies two constants, EXIT_SUCCESS and  EXIT_FAILURE, that may
be  passed  to exit() to indicate successful or unsuccessful termination,
respectively. The value of status in exit(status) may be EXIT_SUCCESS,
EXIT_FAILURE, or any other value, though only the least significant 8 bits (that
is, status & 0377) shall be available to a waiting parent proces. So exit(-1)
return 255.

EXIT_SUCCESS or EXIT_FAILURE are already used in some functions in git but
not everywhere. Also in branch.c there is a returns exit(-1), ie 255, when
exit(1) might be more appropriate.

T$his patch series adds a coccinelle semantic patch exit.cocci in
contrib/coccinelle to rewrite:
- exit(0) in exit(EXIT_SUCCESS)
- exit(1) in exit(EXIT_FAILURE)
- exit(-1) in exit(EXIT_FAILURE)

The patch treats the status code in _exit equivalently.



Elia Pinto (41):
  archive.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  branch.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  am.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  blame.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  commit.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  credential-cache--daemon.c: use the stdlib EXIT_SUCCESS or
    EXIT_FAILURE exit status
  help.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  init-db.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  mailsplit.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  merge-index.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  merge.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  pull.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  rebase.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  remote-ext.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  rev-parse.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  rm.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  shortlog.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  show-branch.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  stash.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  tag.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  unpack-objects.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit
    status
  update-index.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit
    status
  obstack.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  git-credential-osxkeychain.c: use the stdlib EXIT_SUCCESS or
    EXIT_FAILURE exit status
  git-credential-wincred.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE
    exit status
  daemon.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  git.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  help.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  http-backend.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit
    status
  parse-options.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit
    status
  path.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  remote-curl.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  run-command.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  setup.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  shell.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  test-json-writer.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit
    status
  test-reach.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  test-submodule-config.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE
    exit status
  test-submodule-nested-repo-config.c: use the stdlib EXIT_SUCCESS or
    EXIT_FAILURE exit status
  upload-pack.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status
  exit.cocci: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status

 archive.c                                     |  2 +-
 branch.c                                      |  4 ++--
 builtin/am.c                                  |  4 ++--
 builtin/blame.c                               |  2 +-
 builtin/commit.c                              | 10 ++++----
 builtin/credential-cache--daemon.c            |  2 +-
 builtin/help.c                                |  2 +-
 builtin/init-db.c                             |  2 +-
 builtin/mailsplit.c                           |  2 +-
 builtin/merge-index.c                         |  2 +-
 builtin/merge.c                               |  4 ++--
 builtin/pull.c                                |  2 +-
 builtin/rebase.c                              | 12 +++++-----
 builtin/remote-ext.c                          |  2 +-
 builtin/rev-parse.c                           |  2 +-
 builtin/rm.c                                  |  2 +-
 builtin/shortlog.c                            |  2 +-
 builtin/show-branch.c                         |  4 ++--
 builtin/stash.c                               |  2 +-
 builtin/tag.c                                 |  2 +-
 builtin/unpack-objects.c                      |  6 ++---
 builtin/update-index.c                        |  4 ++--
 compat/obstack.c                              |  2 +-
 contrib/coccinelle/exit.cocci                 | 24 +++++++++++++++++++
 .../osxkeychain/git-credential-osxkeychain.c  |  4 ++--
 .../wincred/git-credential-wincred.c          |  2 +-
 daemon.c                                      |  2 +-
 git.c                                         | 14 +++++------
 help.c                                        |  8 +++----
 http-backend.c                                | 12 +++++-----
 parse-options.c                               |  2 +-
 path.c                                        |  2 +-
 remote-curl.c                                 |  2 +-
 run-command.c                                 |  2 +-
 setup.c                                       |  2 +-
 shell.c                                       |  2 +-
 t/helper/test-json-writer.c                   |  2 +-
 t/helper/test-reach.c                         |  2 +-
 t/helper/test-submodule-config.c              |  2 +-
 t/helper/test-submodule-nested-repo-config.c  |  2 +-
 upload-pack.c                                 |  2 +-
 41 files changed, 95 insertions(+), 71 deletions(-)
 create mode 100644 contrib/coccinelle/exit.cocci

-- 
2.35.1


^ permalink raw reply	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2022-03-23 11:13 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-21 22:54 [PATCH 00/41] use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status Elia Pinto
2022-03-21 22:54 ` [PATCH 01/41] archive.c: " Elia Pinto
2022-03-21 22:54 ` [PATCH 02/41] branch.c: " Elia Pinto
2022-03-21 22:54 ` [PATCH 03/41] am.c: " Elia Pinto
2022-03-21 22:54 ` [PATCH 04/41] blame.c: " Elia Pinto
2022-03-21 22:54 ` [PATCH 05/41] commit.c: " Elia Pinto
2022-03-21 22:54 ` [PATCH 06/41] credential-cache--daemon.c: " Elia Pinto
2022-03-21 22:54 ` [PATCH 07/41] help.c: " Elia Pinto
2022-03-21 22:54 ` [PATCH 08/41] init-db.c: " Elia Pinto
2022-03-21 22:54 ` [PATCH 09/41] mailsplit.c: " Elia Pinto
2022-03-21 22:54 ` [PATCH 10/41] merge-index.c: " Elia Pinto
2022-03-21 22:54 ` [PATCH 11/41] merge.c: " Elia Pinto
2022-03-21 22:54 ` [PATCH 12/41] pull.c: " Elia Pinto
2022-03-21 22:54 ` [PATCH 13/41] rebase.c: " Elia Pinto
2022-03-21 22:54 ` [PATCH 14/41] remote-ext.c: " Elia Pinto
2022-03-21 22:54 ` [PATCH 15/41] rev-parse.c: " Elia Pinto
2022-03-21 22:54 ` [PATCH 16/41] rm.c: " Elia Pinto
2022-03-21 22:54 ` [PATCH 17/41] shortlog.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 18/41] show-branch.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 19/41] stash.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 20/41] tag.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 21/41] unpack-objects.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 22/41] update-index.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 23/41] obstack.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 24/41] git-credential-osxkeychain.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 25/41] git-credential-wincred.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 26/41] daemon.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 27/41] git.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 28/41] help.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 29/41] http-backend.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 30/41] parse-options.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 31/41] path.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 32/41] remote-curl.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 33/41] run-command.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 34/41] setup.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 35/41] shell.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 36/41] test-json-writer.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 37/41] test-reach.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 38/41] test-submodule-config.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 39/41] test-submodule-nested-repo-config.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 40/41] upload-pack.c: " Elia Pinto
2022-03-21 22:55 ` [PATCH 41/41] exit.cocci: " Elia Pinto
2022-03-22  6:49 ` [PATCH 00/41] " Bagas Sanjaya
2022-03-22  8:45   ` Elia Pinto
2022-03-22 11:21   ` Bagas Sanjaya
2022-03-22  8:26 ` Ævar Arnfjörð Bjarmason
2022-03-22 17:47   ` Elia Pinto
2022-03-23 11:13   ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.