git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 18/18] Clearly rewrite double dereference

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jun 7, 2013, 04:04 UTC
Message-ID
<CAPig+cQdwO9dBr2xVC4z8=M6_ELJdLNhzZa5DUW-MCo6_gOAJA@mail.gmail.com>
In-Reply-To
<1370547263-13558-19-git-send-email-celestin.matte@ensimag.fr>

On Thu, Jun 6, 2013 at 3:34 PM, Célestin Matte <celestin.matte@ensimag.fr> wrote:

Show 19 quoted lines
> @$var structures are re-written in the following way: @{ $var }
> It makes them more readable.
>
> Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>
> Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
> ---
>  contrib/mw-to-git/git-remote-mediawiki.perl |   12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl
> index 20ddccb..06e6f4d 100755
> --- a/contrib/mw-to-git/git-remote-mediawiki.perl
> +++ b/contrib/mw-to-git/git-remote-mediawiki.perl
> @@ -233,7 +233,7 @@ sub get_mw_tracked_pages {
>  sub get_mw_page_list {
>         my $page_list = shift;
>         my $pages = shift;
> -       my @some_pages = @$page_list;
> +       my @some_pages = @{ $page_list };

Minor style nit: Existing code in git-remote-mediawiki.perl does not have whitespace inside @{}. It prefers @{$foo} rather than @{ $foo }. This nit applies to this entire patch.

Show 55 quoted lines
>         while (@some_pages) {
>                 my $last_page = $SLICE_SIZE;
>                 if ($#some_pages < $last_page) {
> @@ -733,7 +733,7 @@ sub import_file_revision {
>
>         print {*STDOUT} "commit refs/mediawiki/${remotename}/master\n";
>         print {*STDOUT} "mark :${n}\n";
> -       print {*STDOUT} "committer ${author} <${author}\@${wiki_name}> " . $date->epoch . " +0000\n";
> +       print {*STDOUT} "committer ${author} <${author}\@{ ${wiki_name} }> " . $date->epoch . " +0000\n";
>         literal_data($comment);
>
>         # If it's not a clone, we need to know where to start from
> @@ -759,7 +759,7 @@ sub import_file_revision {
>                 print {*STDOUT} "reset refs/notes/${remotename}/mediawiki\n";
>         }
>         print {*STDOUT} "commit refs/notes/${remotename}/mediawiki\n";
> -       print {*STDOUT} "committer ${author} <${author}\@${wiki_name}> " . $date->epoch . " +0000\n";
> +       print {*STDOUT} "committer ${author} <${author}\@{ ${wiki_name} }> " . $date->epoch . " +0000\n";
>         literal_data('Note added by git-mediawiki during import');
>         if (!$full_import && $n == 1) {
>                 print {*STDOUT} "from refs/notes/${remotename}/mediawiki^0\n";
> @@ -881,7 +881,7 @@ sub mw_import_revids {
>         my $n_actual = 0;
>         my $last_timestamp = 0; # Placeholer in case $rev->timestamp is undefined
>
> -       foreach my $pagerevid (@$revision_ids) {
> +       foreach my $pagerevid (@{ $revision_ids }) {
>                 # Count page even if we skip it, since we display
>                 # $n/$total and $total includes skipped pages.
>                 $n++;
> @@ -916,7 +916,7 @@ sub mw_import_revids {
>                 my $page_title = $result_page->{title};
>
>                 if (!exists($pages->{$page_title})) {
> -                       print {*STDERR} "${n}/", scalar(@$revision_ids),
> +                       print {*STDERR} "${n}/", scalar(@ { $revision_ids }),
>                                 ": Skipping revision #$rev->{revid} of ${page_title}\n";
>                         next;
>                 }
> @@ -949,7 +949,7 @@ sub mw_import_revids {
>                 # If this is a revision of the media page for new version
>                 # of a file do one common commit for both file and media page.
>                 # Else do commit only for that page.
> -               print {*STDERR} "${n}/", scalar(@$revision_ids), ": Revision #$rev->{revid} of $commit{title}\n";
> +               print {*STDERR} "${n}/", scalar(@{ $revision_ids }), ": Revision #$rev->{revid} of $commit{title}\n";
>                 import_file_revision(\%commit, ($fetch_from == 1), $n_actual, \%mediafile);
>         }
>
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous: Célestin Matte
Message 44 of 44 in “git-remote-mediawiki: Follow perlcritic's recommandations”
  1. 00/18 git-remote-mediawiki: Follow perlcritic's recommandationsCélestin Matte, Jun 6, 2013
  2. 01/18 Follow perlcritic's recommendations - level 5 and 4Célestin Matte, Jun 6, 2013
  3. Eric SunshineJun 7, 2013
  4. Matthieu MoyJun 7, 2013
  5. Célestin MatteJun 7, 2013
  6. Matthieu MoyJun 7, 2013
  7. 02/18 Change style of some regular expressions to make them clearerCélestin Matte, Jun 6, 2013
  8. Eric SunshineJun 7, 2013
  9. Junio C HamanoJun 7, 2013
  10. Eric SunshineJun 7, 2013
  11. Junio C HamanoJun 7, 2013
  12. Peter KreftingJun 7, 2013
  13. 03/18 Add newline in the end of die() error messagesCélestin Matte, Jun 6, 2013
  14. 04/18 Prevent local variable $url to have the same name as a global variableCélestin Matte, Jun 6, 2013
  15. 05/18 Turn double-negated expressions into simple expressionsCélestin Matte, Jun 6, 2013
  16. Eric SunshineJun 7, 2013
  17. Célestin MatteJun 7, 2013
  18. Eric SunshineJun 7, 2013
  19. Célestin MatteJun 7, 2013
  20. 06/18 Remove unused variableCélestin Matte, Jun 6, 2013
  21. 07/18 Rename a variable ($last) so that it does not have the name of a keywordCélestin Matte, Jun 6, 2013
  22. 08/18 Explicitely assign local variable as undef and make a proper one-instruction-by- line indentationCélestin Matte, Jun 6, 2013
  23. Eric SunshineJun 7, 2013
  24. Matthieu MoyJun 7, 2013
  25. 09/18 Check return value of open and remove import of unused open2Célestin Matte, Jun 6, 2013
  26. Matthieu MoyJun 7, 2013
  27. 10/18 Put long code into a submoduleCélestin Matte, Jun 6, 2013
  28. Eric SunshineJun 7, 2013
  29. Junio C HamanoJun 7, 2013
  30. 11/18 Modify strings for a better coding-styleCélestin Matte, Jun 6, 2013
  31. Eric SunshineJun 7, 2013
  32. 12/18 Brace file handles for print for more clarityCélestin Matte, Jun 6, 2013
  33. 13/18 Remove "unless" statements and replace them by negated "if" statementsCélestin Matte, Jun 6, 2013
  34. Eric SunshineJun 7, 2013
  35. 14/18 Don't use quotes for empty stringsCélestin Matte, Jun 6, 2013
  36. 15/18 Put non-trivial numeric values (e.g., different from 0, 1 and 2) in constants.Célestin Matte, Jun 6, 2013
  37. 16/18 Fix a typo ("mediwiki" instead of "mediawiki")Célestin Matte, Jun 6, 2013
  38. 17/18 Place the open() call inside the do{} struct and prevent failing closeCélestin Matte, Jun 6, 2013
  39. Junio C HamanoJun 6, 2013
  40. Célestin MatteJun 6, 2013
  41. Junio C HamanoJun 6, 2013
  42. Célestin MatteJun 6, 2013
  43. 18/18 Clearly rewrite double dereferenceCélestin Matte, Jun 6, 2013
  44. Eric SunshineJun 7, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.