style cleanup and sarcastic comments
authorArt Cancro <ajc@citadel.org>
Tue, 27 Jun 2023 20:31:25 +0000 (16:31 -0400)
committerArt Cancro <ajc@citadel.org>
Tue, 27 Jun 2023 20:31:25 +0000 (16:31 -0400)
libcitadel/lib/libcitadel.c
libcitadel/lib/vnote.c
libcitadel/lib/wildfire.c

index bc88219ff0b0966e266e051ceea4d23ae41f8a1c..f9946f1e6f511ff2f30f5d95bcc39883f03ee185 100644 (file)
@@ -1,11 +1,10 @@
-/*
- * Main stuff for libcitadel
- *
- * Copyright (c) 1987-2013 by the citadel.org team
- *
+//
+// Main stuff for libcitadel
+//
+// Copyright (c) 1987-2013 by the citadel.org team
+//
 // This program is open source software.  Use, duplication, or disclosure
 // is subject to the terms of the GNU General Public License, version 3.
- */
 
 #include <stdlib.h>
 #include <unistd.h>
@@ -33,8 +32,6 @@ ConstStr RoomNetCfgStrs[maxRoomNetCfg] = {
 // No, not one of..    {HKEY(strof(maxRoomNetCfg))}
 };
 
-
-
 extern int EnableSplice;
 extern int ZLibCompressionRatio;
 
@@ -46,8 +43,7 @@ int libcitadel_version_number(void) {
        return LIBCITADEL_VERSION_NUMBER;
 }
 
-void ShutDownLibCitadel(void)
-{
+void ShutDownLibCitadel(void) {
        ShutDownLibCitadelMime();
        WildFireShutdown();
        xdg_mime_shutdown();
index 7f50026776d1670342d8925cbc8d3fab20d1acab..4460c3323fe46d617d3600e9a8fecc8043fef44e 100644 (file)
@@ -1,11 +1,9 @@
-/*
- * vNote implementation for Citadel
- *
- * Copyright (C) 1999-2007 by the citadel.org development team.
- *
+// vNote implementation for Citadel
+//
+// Copyright (C) 1999-2007 by the citadel.org development team.
+//
 // This program is open source software.  Use, duplication, or disclosure
 // is subject to the terms of the GNU General Public License, version 3.
- */
 
 
 #include <stdlib.h>
@@ -160,10 +158,9 @@ struct vnote *vnote_new_from_str(char *s) {
                                        free(decoded_value);    // throw it away
                                }
 
-                               /* FIXME still need to handle these:
-                                * X-OUTLOOK-CREATE-TIME:20070611T204615Z
-                                * REV:20070611T204621Z
-                                */
+                               // FIXME still need to handle these:
+                               // X-OUTLOOK-CREATE-TIME:20070611T204615Z
+                               // REV:20070611T204621Z
                        }
                        free(thisline);
                }
@@ -185,7 +182,7 @@ void vnote_free(struct vnote *v) {
 }
 
 
-/* helper function for vnote_serialize() */
+// helper function for vnote_serialize()
 void vnote_serialize_output_field(char *append_to, char *field, char *label) {
 
        char *mydup;
@@ -253,8 +250,7 @@ char *vnote_serialize(struct vnote *v) {
        vnote_serialize_output_field(s, v->summary, "SUMMARY");
        vnote_serialize_output_field(s, v->body, "BODY");
        vnote_serialize_output_field(s, v->body, "NOTE");
-       sprintf(&s[strlen(s)], "X-OUTLOOK-COLOR:#%02X%02X%02X\r\n",
-               v->color_red, v->color_green, v->color_blue);
+       sprintf(&s[strlen(s)], "X-OUTLOOK-COLOR:#%02X%02X%02X\r\n", v->color_red, v->color_green, v->color_blue);
        sprintf(&s[strlen(s)], "X-OUTLOOK-LEFT:%d\r\n", v->pos_left);
        sprintf(&s[strlen(s)], "X-OUTLOOK-TOP:%d\r\n", v->pos_top);
        sprintf(&s[strlen(s)], "X-OUTLOOK-WIDTH:%d\r\n", v->pos_width);
index c1fd2e3ccc034b79b92cc455b67a17abec1fa627..b15c9825a7bd2d3d9aef401f55c35e3072bb81ae 100644 (file)
@@ -1,3 +1,6 @@
+// This doesn't belong in the build but WebCit-classic depends on it.
+// When we move to WebCit-NG we will axe this.
+
 /*@{*/
 
 #include "sysdep.h"
@@ -27,17 +30,11 @@ ConstStr WF_MsgStrs[] = {
        {HKEY("EXCEPTION")}
 };
 
-static JsonValue *WFInfo(const char *Filename, long fnlen,
-                        long LineNo, 
-                        WF_MessageType Type)
-{
+static JsonValue *WFInfo(const char *Filename, long fnlen, long LineNo, WF_MessageType Type) {
        JsonValue *Val;
 
        Val = NewJsonObject(NULL, 0);
-       JsonObjectAppend(Val, 
-                        NewJsonPlainString(HKEY("Type"),
-                                           WF_MsgStrs[Type].Key, 
-                                           WF_MsgStrs[Type].len));
+       JsonObjectAppend(Val, NewJsonPlainString(HKEY("Type"), WF_MsgStrs[Type].Key, WF_MsgStrs[Type].len));
        JsonObjectAppend(Val, 
                         NewJsonPlainString(HKEY("File"), 
                                            Filename, fnlen));
@@ -47,11 +44,7 @@ static JsonValue *WFInfo(const char *Filename, long fnlen,
 }
                            
 
-JsonValue *WildFireMessage(const char *Filename, long fnlen,
-                          long LineNo,
-                          StrBuf *Msg, 
-                          WF_MessageType Type)
-{
+JsonValue *WildFireMessage(const char *Filename, long fnlen, long LineNo, StrBuf *Msg, WF_MessageType Type) {
        JsonValue *Ret;
 
        Ret = NewJsonArray(NULL, 0);
@@ -62,30 +55,19 @@ JsonValue *WildFireMessage(const char *Filename, long fnlen,
        return Ret;
 }
 
-JsonValue *WildFireMessagePlain(const char *Filename, long fnlen,
-                               long LineNo,
-                               const char *Message, long len, 
-                               WF_MessageType Type)
-{
+JsonValue *WildFireMessagePlain(const char *Filename, long fnlen, long LineNo, const char *Message, long len, WF_MessageType Type) {
        JsonValue *Val;
        Val = NewJsonArray(NULL, 0);
 
-       JsonArrayAppend(Val, WFInfo(Filename, fnlen,
-                                   LineNo, Type));
-       JsonArrayAppend(Val, 
-                       NewJsonPlainString(NULL, 0, Message, len));
+       JsonArrayAppend(Val, WFInfo(Filename, fnlen, LineNo, Type));
+       JsonArrayAppend(Val, NewJsonPlainString(NULL, 0, Message, len));
        return Val;
 }
 
-void WildFireAddArray(JsonValue *ReportBase, JsonValue *Array, WF_MessageType Type)
-{
+void WildFireAddArray(JsonValue *ReportBase, JsonValue *Array, WF_MessageType Type) {
        JsonValue *Val;
        Val = NewJsonArray(NULL, 0);
-       JsonArrayAppend(Val, 
-                       NewJsonPlainString(NULL, 0, 
-                                          WF_MsgStrs[Type].Key, 
-                                          WF_MsgStrs[Type].len));
-
+       JsonArrayAppend(Val, NewJsonPlainString(NULL, 0, WF_MsgStrs[Type].Key, WF_MsgStrs[Type].len));
        JsonArrayAppend(Val, Array);
 }
 
@@ -136,19 +118,12 @@ static void start_addr2line_daemon(const char *binary)
        }
 }
 
-static int addr2lineBacktrace(StrBuf *Function, 
-                             StrBuf *FileName, 
-                             StrBuf *Pointer, 
-                             StrBuf *Buf,
-                             unsigned int *FunctionLine)
-
-{
+static int addr2lineBacktrace(StrBuf *Function, StrBuf *FileName, StrBuf *Pointer, StrBuf *Buf, unsigned int *FunctionLine) {
        const char *err;
        const char *pch, *pche;
 
        write(addr2line_write_pipe[1], SKEY(Pointer));
-       if (StrBufTCP_read_line(Buf, &addr2line_read_pipe[0], 0, &err) <= 0)
-       {
+       if (StrBufTCP_read_line(Buf, &addr2line_read_pipe[0], 0, &err) <= 0) {
                StrBufAppendBufPlain(Buf, err, -1, 0);
                return 0;
        }
@@ -156,8 +131,7 @@ static int addr2lineBacktrace(StrBuf *Function,
        pche = strchr(pch, ':');
        FlushStrBuf(FileName);
        StrBufAppendBufPlain(FileName, pch, pche - pch, 0);
-       if (pche != NULL)
-       {
+       if (pche != NULL) {
                pche++;
                *FunctionLine = atoi(pche);
        }
@@ -166,11 +140,7 @@ static int addr2lineBacktrace(StrBuf *Function,
        return 1;
 }
 
-static int ParseBacktrace(char *Line, 
-                         StrBuf *Function, 
-                         StrBuf *FileName, 
-                         unsigned int *FunctionLine)
-{
+static int ParseBacktrace(char *Line, StrBuf *Function, StrBuf *FileName, unsigned int *FunctionLine) {
        char *pch, *pche;
 
        pch = Line;
@@ -193,16 +163,14 @@ static int ParseBacktrace(char *Line,
 long BaseFrames = 0;
 StrBuf *FullBinaryName = NULL;
 
-void WildFireShutdown(void)
-{
+void WildFireShutdown(void) {
        close(addr2line_write_pipe[0]);
        close(addr2line_read_pipe[0]);
 
        FreeStrBuf(&FullBinaryName);
 }
 
-void WildFireInitBacktrace(const char *argvNull, int AddBaseFrameSkip)
-{
+void WildFireInitBacktrace(const char *argvNull, int AddBaseFrameSkip) {
 
 #ifdef HAVE_BACKTRACE
        void *stack_frames[100];
@@ -242,12 +210,10 @@ void WildFireInitBacktrace(const char *argvNull, int AddBaseFrameSkip)
                        i = size;
                 }
        }
-       if ((stat(ChrPtr(FullBinaryName), &filestats)==-1) ||
-           (filestats.st_size==0)){
+       if ((stat(ChrPtr(FullBinaryName), &filestats)==-1) || (filestats.st_size==0)) {
                FlushStrBuf(FullBinaryName);
                StrBufAppendBufPlain(FullBinaryName, argvNull, -1, 0);
-               if ((stat(ChrPtr(FullBinaryName), &filestats)==-1) ||
-                   (filestats.st_size==0)){
+               if ((stat(ChrPtr(FullBinaryName), &filestats)==-1) || (filestats.st_size==0)) {
                        FlushStrBuf(FullBinaryName);
                        fprintf(stderr, "unable to open my binary for addr2line checking, verbose backtraces won't work.\n");
                }
@@ -260,16 +226,10 @@ void WildFireInitBacktrace(const char *argvNull, int AddBaseFrameSkip)
        if (StrLength(FullBinaryName) > 0)
                start_addr2line_daemon(ChrPtr(FullBinaryName));
 #endif
-
-
 }
 
 
-JsonValue *WildFireException(const char *Filename, long FileLen,
-                            long LineNo,
-                            StrBuf *Message,
-                            int StackOffset)
-{
+JsonValue *WildFireException(const char *Filename, long FileLen, long LineNo, StrBuf *Message, int StackOffset) {
        JsonValue *ExcClass;
        JsonValue *Val;
        Val = NewJsonArray(NULL, 0);
@@ -345,8 +305,7 @@ JsonValue *WildFireException(const char *Filename, long FileLen,
        return Val;
 }
 
-void WildFireSerializePayload(StrBuf *JsonBuffer, StrBuf *OutBuf, int *MsgCount, AddHeaderFunc AddHdr)
-{
+void WildFireSerializePayload(StrBuf *JsonBuffer, StrBuf *OutBuf, int *MsgCount, AddHeaderFunc AddHdr) {
        int n = *MsgCount;
        StrBuf *Buf;
        StrBuf *HeaderName;