]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Maintenance: Update astyle version to 3.1 (#841)
authorAmos Jeffries <yadij@users.noreply.github.com>
Fri, 11 Jun 2021 09:28:25 +0000 (09:28 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Fri, 11 Jun 2021 11:46:52 +0000 (11:46 +0000)
Version 2.04 is quite outdated now, and there are only minor
formatting differences with v3.1. All changes look to be good syntax.

Also, pass the astyle executable with command line option to
formater.pl. Avoiding environment variables which do not work on servers
with sanitized sub-shell environments such as our main server.

13 files changed:
compat/GnuRegex.c
lib/base64.c
lib/smblib/smblib-util.c
scripts/formater.pl
scripts/source-maintenance.sh
src/DiskIO/IpcIo/IpcIoFile.cc
src/acl/external/kerberos_ldap_group/support.h
src/adaptation/ecap/ServiceRep.cc
src/clients/FtpClient.cc
src/comm.cc
src/dns_internal.cc
src/fs/rock/RockIoRequests.cc
src/peer_select.cc

index 775830204ce9e799060964e01422bfcb59d31615..344da3ad631236fedc62e3038de5be8bee63cb63 100644 (file)
@@ -2757,7 +2757,7 @@ static int
 wordchar_p(const char *d, const char *end1, const char *string2)
 {
     return re_syntax_table[(d) == end1 ? *string2
-                           : (d) == string2 - 1 ? *(end1 - 1) : *(d)]
+                               : (d) == string2 - 1 ? *(end1 - 1) : *(d)]
            == Sword;
 }
 
index a2f2dfa2f9a77f4a24ba3fbfcc3920f7c7b24a19..3fa002ef7eca2f2019b5c0c0366686e03dd9a934 100644 (file)
@@ -57,22 +57,22 @@ base64_decode_init(struct base64_decode_ctx *ctx)
     {
         /* White space is HT, VT, FF, CR, LF and SPC */
         -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, -2, -2, -2, -1, -1,
-        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-        -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
-        52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -3, -1, -1,
-        -1,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14,
-        15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
-        -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
-        41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1,
-        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-        -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    };
+            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+            -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
+            52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -3, -1, -1,
+            -1,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14,
+            15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
+            -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+            41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1,
+            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+        };
 
     ctx->word = ctx->bits = ctx->padding = 0;
     ctx->table = base64_decode_table;
index b914c7ed9c9762a291ec2830f2536dde8c3a97c9..c6376693b8c1b79e6b001cfbbda71dbbd0c8db5b 100644 (file)
@@ -52,7 +52,7 @@ int SMB_Types[] = {SMB_P_Core,
                    SMB_P_NT1,
                    SMB_P_NT1,
                    -1
-                  };
+                   };
 
 #if UNDEFINED
 char *SMB_DOSTimToStr(int DOS_time);
index d77579bca709af2fdad7dd1067b65485d230bcfd..91efbbf121a4bfb7aea3d9cfcede00ad8147404e 100755 (executable)
 
 use strict;
 use IPC::Open2;
+use Getopt::Long;
 
-my $ASTYLE_BIN = defined $ENV{'ASTYLE'} ? $ENV{'ASTYLE'} : 'astyle';
+my $ASTYLE_BIN = "astyle";
 my $ASTYLE_ARGS ="--mode=c -s4 --convert-tabs --keep-one-line-blocks --lineend=linux";
 #$ASTYLE_ARGS="--mode=c -s4 -O --break-blocks -l";
 
+Getopt::Long::Configure("require_order");
+GetOptions(
+       'help', sub { usage($0) },
+       'with-astyle=s', \$ASTYLE_BIN
+       ) or die(usage($0));
+
 $ASTYLE_BIN=$ASTYLE_BIN." ".$ASTYLE_ARGS;
 
 my $INDENT = "";
 
 my $out = shift @ARGV;
-#read options, currently no options available
-while($out eq "" ||  $out =~ /^-\w+$/){
-    if($out eq "-h") {
-        usage($0);
-        exit 0;
-    } else {
-        usage($0);
-        exit -1;
-    }
-}
-
-
 while($out){
 
     if( $out !~ /\.cc$|\.cci$|\.h$|\.c$/) {
@@ -207,5 +202,10 @@ sub output_filter{
 
 sub usage{
     my($name)=@_;
-    print "Usage:\n   $name file1 file2 file3 ....\n";
+    print "Usage:\n";
+    print "   $name [options] file1 file2 file3 ....\n";
+    print "\n";
+    print "Options:\n";
+    print "    --help              This usage text.\n";
+    print "    --with-astyle <PATH>  astyle executable to use.\n";
 }
index 1c5addc692f531619d81eb7014a6142803471388..8d5a64d5a2319f38aa4ac11a4b429bf2c4895d71 100755 (executable)
@@ -33,7 +33,7 @@ KeepGoingDirective=""
 # has changed in different releases.
 # if --with-astyle /path/to/astyle is used, the check is still performed
 # and a warning is printed, but the sources are reformatted
-TargetAstyleVersion="2.04"
+TargetAstyleVersion="3.1"
 ASTYLE='astyle'
 
 # whether to check and, if necessary, update boilerplate copyright years
@@ -71,7 +71,6 @@ while [ $# -ge 1 ]; do
         ;;
     --with-astyle)
         ASTYLE=$2
-        export ASTYLE
         shift 2
         ;;
     *)
@@ -231,7 +230,7 @@ for FILENAME in `git ls-files`; do
        #
        applyPluginsTo ${FILENAME} scripts/maintenance/ || return
        if test "${ASVER}"; then
-               ./scripts/formater.pl ${FILENAME}
+               ./scripts/formater.pl --with-astyle ${ASTYLE} ${FILENAME}
                if test -e $FILENAME -a -e "$FILENAME.astylebak"; then
                        md51=`cat  $FILENAME| tr -d "\n \t\r" | $MD5`;
                        md52=`cat  $FILENAME.astylebak| tr -d "\n \t\r" | $MD5`;
index 0211e5faa9e36938be3d1daf87e1f1ff9a77ea6d..0ecbdb4bbf412185ab6a0da08cb1690f2e85a3e3 100644 (file)
@@ -615,7 +615,7 @@ IpcIoFile::scheduleTimeoutCheck()
     CallService(nullptr, [&] {
         // we check all older requests at once so some may be wait for 2*Timeout
         eventAdd("IpcIoFile::CheckTimeouts", &IpcIoFile::CheckTimeouts,
-        reinterpret_cast<void *>(diskId), Timeout, 0, false);
+                 reinterpret_cast<void *>(diskId), Timeout, 0, false);
         timeoutCheckScheduled = true;
     });
 }
index 377c2fddd323fa1211bd09ad2fcf6af00f728e7b..2d9803f2d58be22474d069ee3998393b28323bd7 100644 (file)
@@ -127,11 +127,11 @@ SQUIDCEXTERN int log_enabled;
 #define error(X...) \
                      fprintf(stderr, "%s(%d): pid=%ld :", __FILE__, __LINE__, (long)getpid() ); \
                      fprintf(stderr,X); \
+
 #define warn(X...) \
                      fprintf(stderr, "%s(%d): pid=%ld :", __FILE__, __LINE__, (long)getpid() ); \
                      fprintf(stderr,X); \
+
 #else /* __GNUC__ */
 
 /* non-GCC compilers can't do the above macro define yet. */
index 5989f1383ded6b421a6c6a8a89a225dd0abb76aa..bc008b2466d236a29b0f7cc8b016e45f7c97eedd 100644 (file)
@@ -152,7 +152,7 @@ Adaptation::Ecap::Engine::kickAsyncServices(timeval &timeout)
 /* Adaptation::Ecap::ServiceRep */
 
 Adaptation::Ecap::ServiceRep::ServiceRep(const ServiceConfigPointer &cfg):
-/*AsyncJob("Adaptation::Ecap::ServiceRep"),*/ Adaptation::Service(cfg),
+    /*AsyncJob("Adaptation::Ecap::ServiceRep"),*/ Adaptation::Service(cfg),
     isDetached(false)
 {
 }
index 1d3b2d93484fafaaae9d5f91f3d9fb1547f4e715..98f4d6975c571b058fa65c8793e42ee17b392d58 100644 (file)
@@ -182,12 +182,12 @@ Ftp::DataChannel::addr(const Ip::Address &import)
 Ftp::Client::Client(FwdState *fwdState):
     AsyncJob("Ftp::Client"),
     ::Client(fwdState),
-     ctrl(),
-     data(),
-     state(BEGIN),
-     old_request(NULL),
-     old_reply(NULL),
-     shortenReadTimeout(false)
+    ctrl(),
+    data(),
+    state(BEGIN),
+    old_request(NULL),
+    old_reply(NULL),
+    shortenReadTimeout(false)
 {
     ++statCounter.server.all.requests;
     ++statCounter.server.ftp.requests;
index 5c049a91d2a45f6afe68590ae9cfdec6a01ea008..60d4f1b39f6bd5764df4ce27d45b6e43364b4fd7 100644 (file)
@@ -1245,8 +1245,8 @@ ClientInfo::writeOrDequeue()
         const auto ccb = COMMIO_FD_WRITECB(head);
         // check that the head descriptor is still relevant
         if (headFde.clientInfo == this &&
-        quotaPeekReserv() == ccb->quotaQueueReserv &&
-        !headFde.closing()) {
+                quotaPeekReserv() == ccb->quotaQueueReserv &&
+                !headFde.closing()) {
 
             // wait for the head descriptor to become ready for writing
             Comm::SetSelect(head, COMM_SELECT_WRITE, Comm::HandleWrite, ccb, 0);
@@ -1627,7 +1627,7 @@ commHalfClosedCheck(void *)
         if (!fd_table[c->fd].halfClosedReader) { // not reading already
             CallBack(fd_table[c->fd].codeContext, [&c] {
                 AsyncCall::Pointer call = commCbCall(5,4, "commHalfClosedReader",
-                CommIoCbPtrFun(&commHalfClosedReader, nullptr));
+                                                     CommIoCbPtrFun(&commHalfClosedReader, nullptr));
                 Comm::Read(c, call);
                 fd_table[c->fd].halfClosedReader = call;
             });
index 70d0ae9c745dfa21caec3e60cb570c1080f0bafa..d75f42ad3546e16615578543694a05b72f63ce22 100644 (file)
@@ -1125,7 +1125,7 @@ idnsCallbackAllCallersWithNewAnswer(const idns_query * const answered, const boo
     for (auto looker = master; looker; looker = looker->queue) {
         CallBack(looker->codeContext, [&] {
             (void)idnsCallbackOneWithAnswer(looker->callback, looker->callback_data,
-            *answered, lastAnswer);
+                                            *answered, lastAnswer);
         });
     }
 }
index d9af9de93730a2d5b0628e4a45f47deaace1ef4c..cb1d23c550420dbec8be867f8dafed24b2ed206f 100644 (file)
@@ -16,18 +16,18 @@ CBDATA_NAMESPACED_CLASS_INIT(Rock, WriteRequest);
 
 Rock::ReadRequest::ReadRequest(const ::ReadRequest &base, const IoState::Pointer &anSio, const IoXactionId anId):
     ::ReadRequest(base),
-     sio(anSio),
-     id(anId)
+    sio(anSio),
+    id(anId)
 {
 }
 
 Rock::WriteRequest::WriteRequest(const ::WriteRequest &base, const IoState::Pointer &anSio, const IoXactionId anId):
     ::WriteRequest(base),
-     sio(anSio),
-     sidPrevious(-1),
-     sidCurrent(-1),
-     id(anId),
-     eof(false)
+    sio(anSio),
+    sidPrevious(-1),
+    sidCurrent(-1),
+    id(anId),
+    eof(false)
 {
 }
 
index 8a22d122c40e5a0df6596917b0f00fb01640604e..97a8e9f2f17c004086305ede2d06e65fd78dbd7a 100644 (file)
@@ -171,7 +171,7 @@ PeerSelectorPingMonitor::noteWaitOver()
         CallBack(selector->al, [selector,this] {
             selector->ping.monitorRegistration = npos();
             AsyncCall::Pointer callback = asyncCall(44, 4, "PeerSelector::HandlePingTimeout",
-            cbdataDialer(PeerSelector::HandlePingTimeout, selector));
+                                                    cbdataDialer(PeerSelector::HandlePingTimeout, selector));
             ScheduleCallHere(callback);
         });
         selectors.erase(selectors.begin());