Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nccf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
702
Provoz
nccf
Commits
70f439d9
Commit
70f439d9
authored
Apr 7, 2020
by
Christian Göttsche
Committed by
Yorhel
Apr 8, 2020
Browse files
Options
Downloads
Patches
Plain Diff
Enforce const correctness on strings
(cherry picked from commit 9801f46ece0ca2525f02d71464efc42296dddcb5)
parent
39709aa6
No related branches found
No related tags found
No related merge requests found
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
src/browser.c
+2
-2
2 additions, 2 deletions
src/browser.c
src/dir_common.c
+1
-1
1 addition, 1 deletion
src/dir_common.c
src/help.c
+1
-1
1 addition, 1 deletion
src/help.c
src/shell.c
+2
-2
2 additions, 2 deletions
src/shell.c
src/util.c
+5
-5
5 additions, 5 deletions
src/util.c
src/util.h
+4
-4
4 additions, 4 deletions
src/util.h
with
15 additions
and
15 deletions
src/browser.c
+
2
−
2
View file @
70f439d9
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
static
int
graph
=
1
,
show_as
=
0
,
info_show
=
0
,
info_page
=
0
,
info_start
=
0
,
show_items
=
0
,
show_mtime
=
0
;
static
int
graph
=
1
,
show_as
=
0
,
info_show
=
0
,
info_page
=
0
,
info_start
=
0
,
show_items
=
0
,
show_mtime
=
0
;
static
char
*
message
=
NULL
;
static
const
char
*
message
=
NULL
;
...
@@ -256,7 +256,7 @@ static void browse_draw_item(struct dir *n, int row) {
...
@@ -256,7 +256,7 @@ static void browse_draw_item(struct dir *n, int row) {
void
browse_draw
()
{
void
browse_draw
()
{
struct
dir
*
t
;
struct
dir
*
t
;
char
*
tmp
;
const
char
*
tmp
;
int
selected
=
0
,
i
;
int
selected
=
0
,
i
;
erase
();
erase
();
...
...
This diff is collapsed.
Click to expand it.
src/dir_common.c
+
1
−
1
View file @
70f439d9
...
@@ -181,7 +181,7 @@ static void draw_error(char *cur, char *msg) {
...
@@ -181,7 +181,7 @@ static void draw_error(char *cur, char *msg) {
void
dir_draw
()
{
void
dir_draw
()
{
float
f
;
float
f
;
char
*
unit
;
const
char
*
unit
;
switch
(
dir_ui
)
{
switch
(
dir_ui
)
{
case
0
:
case
0
:
...
...
This diff is collapsed.
Click to expand it.
src/help.c
+
1
−
1
View file @
70f439d9
...
@@ -33,7 +33,7 @@ int page, start;
...
@@ -33,7 +33,7 @@ int page, start;
#define KEYS 19
#define KEYS 19
char
*
keys
[
KEYS
*
2
]
=
{
const
char
*
keys
[
KEYS
*
2
]
=
{
/*|----key----| |----------------description----------------|*/
/*|----key----| |----------------description----------------|*/
"up, k"
,
"Move cursor up"
,
"up, k"
,
"Move cursor up"
,
"down, j"
,
"Move cursor down"
,
"down, j"
,
"Move cursor down"
,
...
...
This diff is collapsed.
Click to expand it.
src/shell.c
+
2
−
2
View file @
70f439d9
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
#include
<sys/wait.h>
#include
<sys/wait.h>
void
shell_draw
()
{
void
shell_draw
()
{
char
*
full_path
;
const
char
*
full_path
;
int
res
;
int
res
;
/* suspend ncurses mode */
/* suspend ncurses mode */
...
@@ -52,7 +52,7 @@ void shell_draw() {
...
@@ -52,7 +52,7 @@ void shell_draw() {
"Press any key to continue."
,
"Press any key to continue."
,
full_path
,
res
);
full_path
,
res
);
}
else
{
}
else
{
char
*
shell
=
getenv
(
"NCDU_SHELL"
);
const
char
*
shell
=
getenv
(
"NCDU_SHELL"
);
if
(
shell
==
NULL
)
{
if
(
shell
==
NULL
)
{
shell
=
getenv
(
"SHELL"
);
shell
=
getenv
(
"SHELL"
);
if
(
shell
==
NULL
)
if
(
shell
==
NULL
)
...
...
This diff is collapsed.
Click to expand it.
src/util.c
+
5
−
5
View file @
70f439d9
...
@@ -62,7 +62,7 @@ char *cropstr(const char *from, int s) {
...
@@ -62,7 +62,7 @@ char *cropstr(const char *from, int s) {
}
}
float
formatsize
(
int64_t
from
,
char
**
unit
)
{
float
formatsize
(
int64_t
from
,
const
char
**
unit
)
{
float
r
=
from
;
float
r
=
from
;
if
(
si
)
{
if
(
si
)
{
if
(
r
<
1000
.
0
f
)
{
*
unit
=
" B"
;
}
if
(
r
<
1000
.
0
f
)
{
*
unit
=
" B"
;
}
...
@@ -87,7 +87,7 @@ float formatsize(int64_t from, char **unit) {
...
@@ -87,7 +87,7 @@ float formatsize(int64_t from, char **unit) {
void
printsize
(
enum
ui_coltype
t
,
int64_t
from
)
{
void
printsize
(
enum
ui_coltype
t
,
int64_t
from
)
{
char
*
unit
;
const
char
*
unit
;
float
r
=
formatsize
(
from
,
&
unit
);
float
r
=
formatsize
(
from
,
&
unit
);
uic_set
(
t
==
UIC_HD
?
UIC_NUM_HD
:
t
==
UIC_SEL
?
UIC_NUM_SEL
:
UIC_NUM
);
uic_set
(
t
==
UIC_HD
?
UIC_NUM_HD
:
t
==
UIC_SEL
?
UIC_NUM_SEL
:
UIC_NUM
);
printw
(
"%5.1f"
,
r
);
printw
(
"%5.1f"
,
r
);
...
@@ -218,7 +218,7 @@ void nccreate(int height, int width, const char *title) {
...
@@ -218,7 +218,7 @@ void nccreate(int height, int width, const char *title) {
}
}
void
ncprint
(
int
r
,
int
c
,
char
*
fmt
,
...)
{
void
ncprint
(
int
r
,
int
c
,
const
char
*
fmt
,
...)
{
va_list
arg
;
va_list
arg
;
va_start
(
arg
,
fmt
);
va_start
(
arg
,
fmt
);
move
(
subwinr
+
r
,
subwinc
+
c
);
move
(
subwinr
+
r
,
subwinc
+
c
);
...
@@ -227,7 +227,7 @@ void ncprint(int r, int c, char *fmt, ...) {
...
@@ -227,7 +227,7 @@ void ncprint(int r, int c, char *fmt, ...) {
}
}
void
nctab
(
int
c
,
int
sel
,
int
num
,
char
*
str
)
{
void
nctab
(
int
c
,
int
sel
,
int
num
,
const
char
*
str
)
{
uic_set
(
sel
?
UIC_KEY_HD
:
UIC_KEY
);
uic_set
(
sel
?
UIC_KEY_HD
:
UIC_KEY
);
ncprint
(
0
,
c
,
"%d"
,
num
);
ncprint
(
0
,
c
,
"%d"
,
num
);
uic_set
(
sel
?
UIC_HD
:
UIC_DEFAULT
);
uic_set
(
sel
?
UIC_HD
:
UIC_DEFAULT
);
...
@@ -355,7 +355,7 @@ void freedir(struct dir *dr) {
...
@@ -355,7 +355,7 @@ void freedir(struct dir *dr) {
}
}
char
*
getpath
(
struct
dir
*
cur
)
{
const
char
*
getpath
(
struct
dir
*
cur
)
{
static
char
*
dat
;
static
char
*
dat
;
static
int
datl
=
0
;
static
int
datl
=
0
;
struct
dir
*
d
,
**
list
;
struct
dir
*
d
,
**
list
;
...
...
This diff is collapsed.
Click to expand it.
src/util.h
+
4
−
4
View file @
70f439d9
...
@@ -106,10 +106,10 @@ int ncresize(int, int);
...
@@ -106,10 +106,10 @@ int ncresize(int, int);
void
nccreate
(
int
,
int
,
const
char
*
);
void
nccreate
(
int
,
int
,
const
char
*
);
/* printf something somewhere in the last created window */
/* printf something somewhere in the last created window */
void
ncprint
(
int
,
int
,
char
*
,
...);
void
ncprint
(
int
,
int
,
const
char
*
,
...);
/* Add a "tab" to a window */
/* Add a "tab" to a window */
void
nctab
(
int
,
int
,
int
,
char
*
);
void
nctab
(
int
,
int
,
int
,
const
char
*
);
/* same as the w* functions of ncurses, with a color */
/* same as the w* functions of ncurses, with a color */
#define ncaddstr(r, c, s) mvaddstr(subwinr+(r), subwinc+(c), s)
#define ncaddstr(r, c, s) mvaddstr(subwinr+(r), subwinc+(c), s)
...
@@ -129,7 +129,7 @@ void nctab(int, int, int, char *);
...
@@ -129,7 +129,7 @@ void nctab(int, int, int, char *);
char
*
cropstr
(
const
char
*
,
int
);
char
*
cropstr
(
const
char
*
,
int
);
/* Converts the given size in bytes into a float (0 <= f < 1000) and a unit string */
/* Converts the given size in bytes into a float (0 <= f < 1000) and a unit string */
float
formatsize
(
int64_t
,
char
**
);
float
formatsize
(
int64_t
,
const
char
**
);
/* print size in the form of xxx.x XB */
/* print size in the form of xxx.x XB */
void
printsize
(
enum
ui_coltype
,
int64_t
);
void
printsize
(
enum
ui_coltype
,
int64_t
);
...
@@ -148,7 +148,7 @@ void freedir(struct dir *);
...
@@ -148,7 +148,7 @@ void freedir(struct dir *);
/* generates full path from a dir item,
/* generates full path from a dir item,
returned pointer will be overwritten with a subsequent call */
returned pointer will be overwritten with a subsequent call */
char
*
getpath
(
struct
dir
*
);
const
char
*
getpath
(
struct
dir
*
);
/* returns the root element of the given dir struct */
/* returns the root element of the given dir struct */
struct
dir
*
getroot
(
struct
dir
*
);
struct
dir
*
getroot
(
struct
dir
*
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment