Skip to content

Commit fd96cde

Browse files
author
Harsh Shandilya
committed
Constify and staticisize wherever relevant
Signed-off-by: Harsh Shandilya <harsh@prjkt.io>
1 parent 954cdc5 commit fd96cde

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

transfer.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#endif
1818

1919
/* Implementation based on popen documentation */
20-
bool can_run_command(const char *cmd) {
20+
static bool can_run_command(const char *cmd) {
2121
if (strchr(cmd, '/')) {
2222
// if cmd includes a slash, no path search must be performed,
2323
// go straight to checking if it's executable
@@ -68,8 +68,8 @@ bool can_run_command(const char *cmd) {
6868

6969
int main(int argc, char *argv[]) {
7070
/* Linux curl check */
71-
char curl[5] = "curl";
72-
bool x;
71+
const char curl[5] = "curl";
72+
static bool x;
7373
x = can_run_command(curl);
7474
/* Only run the uploader when curl binary is found & is executable */
7575
if (x) {
@@ -83,18 +83,18 @@ int main(int argc, char *argv[]) {
8383

8484
#ifdef GET_FILE_SIZE
8585
if (getenv("TRANSFER_DISABLE_FILESIZE") == NULL) {
86-
struct stat st;
86+
static struct stat st;
8787
stat(argv[1], &st);
8888
// convert bytes to mb (devide by 1024*1024)
89-
float mb = st.st_size / 1048576;
89+
const float mb = st.st_size / 1048576;
9090
printf("The size of the file going to be uploaded is near to %.2f "
9191
"megabytes\n",
92-
mb);
92+
mb);
9393
}
9494
#endif
9595

96-
char cmdbuf[256];
97-
int ret;
96+
static char cmdbuf[256];
97+
static int ret;
9898

9999
#ifdef PROGRESS_BAR
100100
sprintf(cmdbuf, "curl --progress-bar -T %s %s | tee /dev/null", argv[1], "https://transfer.sh");

0 commit comments

Comments
 (0)