Skip to content

Commit

Permalink
Merge pull request #2588 from Sea-n/master
Browse files Browse the repository at this point in the history
Optimize include stmts, Fix IDE warnings and typos
  • Loading branch information
allinurl authored Dec 5, 2023
2 parents 7df2f8f + b04c674 commit 0131a74
Show file tree
Hide file tree
Showing 41 changed files with 71 additions and 119 deletions.
12 changes: 6 additions & 6 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Changes to GoAccess 1.6.4 - Friday, September 30, 2022
- Added Korean translation (i18n).
- Added the ability to use filenames as virtualhosts using
'--fname-as-vhost=<regex>'.
- Enabled clawlers/bots under the OSs panel instead of being shown as
- Enabled crawlers/bots under the OSs panel instead of being shown as
'Unknown'.
- Updated the format on the command-line help output.

Expand Down Expand Up @@ -203,7 +203,7 @@ Changes to GoAccess 1.5 - Wednesday, May 26, 2021
- Changed command line option from '--hide-referer' to '--hide-referrer'.
- Changed command line option from '--ignore-referer' to '--ignore-referrer'.
- Fixed a potential division by zero.
- Fixed inablity to parse IPv6 when using a 'CADDY' log format.
- Fixed inability to parse IPv6 when using a 'CADDY' log format.
- Fixed issue where a 'BSD' OS could be displayed as Linux with certain
user-agents.
- Fixed memory leak when a JSON value contained an empty string (e.g.,
Expand All @@ -215,7 +215,7 @@ Changes to GoAccess 1.5 - Wednesday, May 26, 2021
- Updated default 'AWS Elastic Load Balancing' log format.
- Updated German translation.
- Updated page size to 24 on the HTML report.
- Updated UNIX OS catergories.
- Updated UNIX OS categories.

Changes to GoAccess 1.4.6 - Sunday, February 28, 2021

Expand Down Expand Up @@ -592,7 +592,7 @@ Changes to GoAccess 1.1 - Tuesday, November 08, 2016
GoAccess now sends the latest JSON data to the client as soon as the
WebSocket connection is opened.
- Ensure localStorage is supported and enabled in the HTML report
- Ensure unknown coutries/continents are listed.
- Ensure unknown countries/continents are listed.
- Fixed D3 chart width overflow issue on Edge.
- Fixed integer to string key conversion for unique visitors. This fixes the
issue where resulting keys would collide with existing keys and thus not
Expand Down Expand Up @@ -1086,8 +1086,8 @@ Changes to GoAccess 0.2 - Sunday, July 25, 2010
- Implemented real-time statistics (RTS). Data will be appended as the log
file grows. Equivalent to "tail -f" on Unix systems
- Implemented screen resize functionality
- Simpliflied creation of the "unique visitors" hash-key.
- Simpliflied the "process_unique_data" function
- Simplified creation of the "unique visitors" hash-key.
- Simplified the "process_unique_data" function
- Various small speed increases & code cleanup

Changes to GoAccess 0.1.2 - Monday, July 12, 2010
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,16 @@ GoAccess has minimal requirements, it's written in C and requires only ncurses.
However, below is a table of some optional dependencies in some distros to
build GoAccess from source.

Distro | NCurses | GeoIP (opt) |GeoIP2 (opt) | OpenSSL (opt)
---------------------- | -----------------|------------------|---------------------- | -------------------
**Ubuntu/Debian** | libncursesw6-dev | libgeoip-dev | libmaxminddb-dev | libssl-dev
**RHEL/CentOS** | ncurses-devel | geoip-devel | libmaxminddb-devel | openssl-devel
**Arch** | ncurses | geoip | libmaxminddb | openssl
**Gentoo** | sys-libs/ncurses | dev-libs/geoip | dev-libs/libmaxminddb | dev-libs/openssl
**Slackware** | ncurses | GeoIP | libmaxminddb | openssl
| Distro | NCurses | GeoIP (opt) | GeoIP2 (opt) | OpenSSL (opt) |
| ---------------------- | ---------------- | ---------------- | --------------------- | -------------------|
| **Ubuntu/Debian** | libncursesw6-dev | libgeoip-dev | libmaxminddb-dev | libssl-dev |
| **RHEL/CentOS** | ncurses-devel | geoip-devel | libmaxminddb-devel | openssl-devel |
| **Arch** | ncurses | geoip | libmaxminddb | openssl |
| **Gentoo** | sys-libs/ncurses | dev-libs/geoip | dev-libs/libmaxminddb | dev-libs/openssl |
| **Slackware** | ncurses | GeoIP | libmaxminddb | openssl |

**Note**: You may need to install build tools like `gcc`, `autoconf`,
`gettext`, `autopoint` etc for compiling/building software from source. e.g.,
`gettext`, `autopoint` etc. for compiling/building software from source. e.g.,
`base-devel`, `build-essential`, `"Development Tools"`.

#### Docker ####
Expand All @@ -229,10 +229,10 @@ You can read more about using the docker image in [DOCKER.md](https://github.com
## Contributing ##

Any help on GoAccess is welcome. The most helpful way is to try it out and give
feedback. Feel free to use the Github issue tracker and pull requests to
feedback. Feel free to use the GitHub issue tracker and pull requests to
discuss and submit code changes.

You can contribute to our translations by editing the .po files direct on Github or using the visual interface [inlang.com](https://inlang.com/editor/github.com/allinurl/goaccess)
You can contribute to our translations by editing the .po files direct on GitHub or using the visual interface [inlang.com](https://inlang.com/editor/github.com/allinurl/goaccess)

[![translation badge](https://inlang.com/badge?url=github.com/allinurl/goaccess)](https://inlang.com/editor/github.com/allinurl/goaccess?ref=badge)

Expand Down Expand Up @@ -281,7 +281,7 @@ started:

And even better, to filter while maintaining opened a pipe to preserve
real-time analysis, we can make use of `tail -f` and a matching pattern tool
such as `grep`, `awk`, `sed`, etc:
such as `grep`, `awk`, `sed`, etc.:

# tail -f access.log | grep -i --line-buffered 'firefox' | goaccess --log-format=COMBINED -

Expand Down Expand Up @@ -456,7 +456,7 @@ append it to the original dataset.
GoAccess keeps track of inodes of all the files processed (assuming files will
stay on the same partition), in addition, it extracts a snippet of data from
the log along with the last line parsed of each file and the timestamp of the
last line parsed. e.g., inode:29627417|line:20012|ts:20171231235059
last line parsed. e.g., `inode:29627417|line:20012|ts:20171231235059`

First, it compares if the snippet matches the log being parsed, if it does, it
assumes the log hasn't changed drastically, e.g., hasn't been truncated. If
Expand Down
8 changes: 4 additions & 4 deletions resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ GoAccess.Util = {
}, 0) >>> 0).toString(16);
},

// Format bytes to human readable
// Format bytes to human-readable
formatBytes: function (bytes, decimals, numOnly) {
if (bytes == 0)
return numOnly ? 0 : '0 Byte';
Expand All @@ -184,7 +184,7 @@ GoAccess.Util = {
return !isNaN(parseFloat(n)) && isFinite(n);
},

// Format microseconds to human readable
// Format microseconds to human-readable
utime2str: function (usec) {
if (usec >= 864E8)
return ((usec) / 864E8).toFixed(2) + ' d';
Expand Down Expand Up @@ -220,7 +220,7 @@ GoAccess.Util = {
if (n >= 1e12) return +(n / 1e12).toFixed(1) + "T";
},

// Format field value to human readable
// Format field value to human-readable
fmtValue: function (value, dataType, decimals, shorten, hlregex, hlvalue) {
var val = 0;
if (!dataType)
Expand Down Expand Up @@ -1058,7 +1058,7 @@ GoAccess.Charts = {
}
},

// Iterate over the item properties and and extract the count value.
// Iterate over the item properties and extract the count value.
extractCount: function (item) {
var o = {};
for (var prop in item)
Expand Down
2 changes: 1 addition & 1 deletion resources/tpls.html
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ <h5 class="pull-left visible-xs hidden-sm hidden-md hidden-lg gheader" id="{{id}
<div class="nav-bars fa fa-bars"></div>
<div class="nav-gears fa fa-cog"></div>
<div class="nav-ws-status fa fa-circle"></div>
<div class="powered hidden-xs hidden-sm">by <a href="https://goaccess.io/">GoAccess</a> <span>v{{version}}</span> and <a href="http://gwsocket.io/">GWSocket</a></div>
<div class="powered hidden-xs hidden-sm">by <a href="https://goaccess.io/">GoAccess</a> <span>v{{version}}</span> and <a href="https://gwsocket.io/">GWSocket</a></div>
</script>

<!-- TPL Nav Bar items -->
Expand Down
3 changes: 1 addition & 2 deletions src/base64.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@
* SOFTWARE.
*/

#include <stdlib.h>
#include <string.h>

#include "base64.h"
#include "xmalloc.h"

/* Encodes the given data with base64..
/* Encodes the given data with base64.
*
* On success, the encoded nul-terminated data, as a string is returned. */
char *
Expand Down
1 change: 0 additions & 1 deletion src/bin2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* I have decided not to change the licence.
*/

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down
1 change: 0 additions & 1 deletion src/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

#include <stdlib.h>
#include <string.h>
#include <limits.h> /* for CHAR_BIT */
#include <stdint.h>

#include "error.h"
Expand Down
1 change: 0 additions & 1 deletion src/browsers.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <string.h>
#include <stddef.h>

#include "opesys.h"
#include "browsers.h"

#include "error.h"
Expand Down
2 changes: 1 addition & 1 deletion src/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ typedef enum SCHEMES {
MONOCHROME,
STD_GREEN,
MONOKAI,
} GShemes;
} GSchemes;

#include "commons.h"

Expand Down
2 changes: 0 additions & 2 deletions src/commons.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>

#include "commons.h"

#include "error.h"
#include "labels.h"
#include "settings.h"
#include "util.h"
Expand Down
4 changes: 1 addition & 3 deletions src/csv.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
#include <inttypes.h>

#include "csv.h"
Expand Down Expand Up @@ -290,7 +288,7 @@ print_csv_summary (FILE *fp) {

#pragma GCC diagnostic warning "-Wformat-nonliteral"

/* Entry point to generate a a csv report writing it to the fp */
/* Entry point to generate a csv report writing it to the fp */
void
output_csv (GHolder *holder, const char *filename) {
GModule module;
Expand Down
2 changes: 1 addition & 1 deletion src/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ unknowns_fprintf (const char *fmt, ...) {
va_end (args);
}

/* Debug otuput */
/* Debug output */
void
dbg_printf (const char *fmt, ...) {
va_list args;
Expand Down
1 change: 1 addition & 0 deletions src/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <curses.h>
#endif

#include <stdio.h>
#include "settings.h"

#define TRACE_SIZE 128
Expand Down
4 changes: 0 additions & 4 deletions src/gdns.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,12 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <ctype.h>
#include <errno.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <time.h>
#include <unistd.h>

#include "gdns.h"

Expand Down
3 changes: 1 addition & 2 deletions src/gholder.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
*/

#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
Expand Down Expand Up @@ -539,7 +538,7 @@ add_host_to_holder (GRawDataItem item, GHolder *h, datatype type, const GPanel *
return;
}

if (conf.anonymize_level == ANONIMYZE_STRONG || conf.anonymize_level == ANONIMYZE_PEDANTIC) {
if (conf.anonymize_level == ANONYMIZE_STRONG || conf.anonymize_level == ANONYMIZE_PEDANTIC) {
m4 = (char *) arr4[conf.anonymize_level - 1];
m6 = (char *) arr6[conf.anonymize_level - 1];
}
Expand Down
4 changes: 2 additions & 2 deletions src/gholder.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
/* Default Anonymization Levels */
typedef enum GAnonymizeLevels_ {
ANONYMIZE_DEFAULT = 1,
ANONIMYZE_STRONG,
ANONIMYZE_PEDANTIC,
ANONYMIZE_STRONG,
ANONYMIZE_PEDANTIC,
} GAnonymizeLevels;

/* Function Prototypes */
Expand Down
10 changes: 1 addition & 9 deletions src/gkhash.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,8 @@
#include <config.h>
#endif

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>

#include "gkhash.h"
Expand Down Expand Up @@ -552,7 +544,7 @@ const GKHashMetric app_metrics[] = {
size_t app_metrics_len = ARRAY_SIZE (app_metrics);
/* *INDENT-ON* */

/* Destroys malloc'd mdule metrics */
/* Destroys malloc'd module metrics */
static void
free_app_metrics (GKHashDB *storage) {
int i, n = 0;
Expand Down
4 changes: 1 addition & 3 deletions src/gkmhash.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
* SOFTWARE.
*/

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
Expand Down Expand Up @@ -168,7 +166,7 @@ free_global_metrics (GKHashGlobal *ghash) {
}
}

/* Destroys malloc'd mdule metrics */
/* Destroys malloc'd module metrics */
static void
free_module_metrics (GKHashModule *mhash, GModule module, uint8_t free_data) {
int i, n = 0;
Expand Down
11 changes: 8 additions & 3 deletions src/goaccess.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ collapse_current_module (void) {
return 0;
}

/* Display message a the bottom of the terminal dashboard that panel
/* Display message at the bottom of the terminal dashboard that panel
* is disabled */
static void
disabled_panel_msg (GModule module) {
Expand Down Expand Up @@ -566,7 +566,7 @@ expand_on_mouse_click (void) {
return 1;
}

/* Scroll dowm expanded module to the last row */
/* Scroll down expanded module to the last row */
static void
scroll_down_expanded_module (void) {
int exp_size = get_num_expanded_data_rows ();
Expand Down Expand Up @@ -1410,7 +1410,12 @@ parse_cmd_line (int argc, char **argv) {

static void
handle_signal_action (GO_UNUSED int sig_number) {
fprintf (stderr, "\nSIGINT caught!\n");
if (sig_number == SIGINT)
fprintf (stderr, "\nSIGINT caught!\n");
else if (sig_number == SIGTERM)
fprintf (stderr, "\nSIGTERM caught!\n");
else
fprintf (stderr, "\nSignal %d caught!\n", sig_number);
fprintf (stderr, "Closing GoAccess...\n");

if (conf.output_stdout && conf.real_time_html)
Expand Down
2 changes: 0 additions & 2 deletions src/gslist.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@
* SOFTWARE.
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <inttypes.h>

#include "gslist.h"
#include "gstorage.h"
Expand Down
3 changes: 1 addition & 2 deletions src/gstorage.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
* SOFTWARE.
*/

#include <stdio.h>
#if !defined __SUNPRO_C
#include <stdint.h>
#endif
Expand Down Expand Up @@ -840,7 +839,7 @@ get_kroot (GKeyData *kdata, const char *root_key, const char *root) {
}

/* Generate a visitor's key given the date specificity. For instance,
* if the specificity if set to hours, then a generated key would
* if the specificity is set to hours, then a generated key would
* look like: 03/Jan/2016:09 */
static void
set_spec_visitor_key (char **fdate, const char *ftime) {
Expand Down
Loading

0 comments on commit 0131a74

Please sign in to comment.