]> 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)
committerAmos Jeffries <yadij@users.noreply.github.com>
Thu, 17 Jun 2021 10:13:51 +0000 (22:13 +1200)
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 81bcd3278978f6534154f7427420eef23768c4dd..b4f28fd1b3ea3c66a718d5a05ca8a5ff6c8b093b 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 85eba1d7c1c8787fba5f9d686a0f58cadfeb9564..4ecbc33c73111f99c49d144aab8538271e36d21d 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 8b4426f5177f33f6455b83a532aacc7917519b0e..b33dc740f49ff8e6ee2b168d31061da3035c038f 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'
 
 # command-line options
@@ -46,7 +46,6 @@ while [ $# -ge 1 ]; do
         ;;
     --with-astyle)
         ASTYLE=$2
-        export ASTYLE
         shift 2
         ;;
     *)
@@ -203,7 +202,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 728419577a52478c96684fa573b6f40ae85946ec..fab1cffabe0f892849eb8662de32fa11f538e542 100644 (file)
@@ -585,7 +585,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 747ed358415c7d835dcc2d8422b4c6894c0d8ae9..8f0694d73c67c469df823d262f96347ae6558afd 100644 (file)
@@ -181,12 +181,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 3c5c6d4b94624fd443438c7039b43b4f63da6839..a9e544656ad1becbd449451116a2a05d5c1f3292 100644 (file)
@@ -1297,8 +1297,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);
@@ -1679,7 +1679,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 ed919bec6540e096f272aa4f2b1ce61529f0f8ed..eab7a2a893ec0039fdaa9098901a1bd8aae1d0a7 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());