Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
da23c8c5
Commit
da23c8c5
authored
Mar 09, 2008
by
Hisham Muhammad
Browse files
Clean up headers by using 'static' whenever possible.
Reduces resulting code size.
parent
12f4f09e
Changes
64
Hide whitespace changes
Inline
Side-by-side
Vector.c
View file @
da23c8c5
...
@@ -218,7 +218,9 @@ inline int Vector_size(Vector* this) {
...
@@ -218,7 +218,9 @@ inline int Vector_size(Vector* this) {
return
this
->
items
;
return
this
->
items
;
}
}
void
Vector_merge
(
Vector
*
this
,
Vector
*
v2
)
{
/*
static void Vector_merge(Vector* this, Vector* v2) {
int i;
int i;
assert(Vector_isConsistent(this));
assert(Vector_isConsistent(this));
...
@@ -229,6 +231,8 @@ void Vector_merge(Vector* this, Vector* v2) {
...
@@ -229,6 +231,8 @@ void Vector_merge(Vector* this, Vector* v2) {
assert(Vector_isConsistent(this));
assert(Vector_isConsistent(this));
}
}
*/
void
Vector_add
(
Vector
*
this
,
void
*
data_
)
{
void
Vector_add
(
Vector
*
this
,
void
*
data_
)
{
assert
(
data_
&&
((
Object
*
)
data_
)
->
class
==
this
->
vectorType
);
assert
(
data_
&&
((
Object
*
)
data_
)
->
class
==
this
->
vectorType
);
Object
*
data
=
data_
;
Object
*
data
=
data_
;
...
@@ -252,7 +256,9 @@ inline int Vector_indexOf(Vector* this, void* search_, Object_Compare compare) {
...
@@ -252,7 +256,9 @@ inline int Vector_indexOf(Vector* this, void* search_, Object_Compare compare) {
return
-
1
;
return
-
1
;
}
}
void
Vector_foreach
(
Vector
*
this
,
Vector_procedure
f
)
{
/*
static void Vector_foreach(Vector* this, Vector_procedure f) {
int i;
int i;
assert(Vector_isConsistent(this));
assert(Vector_isConsistent(this));
...
@@ -260,3 +266,5 @@ void Vector_foreach(Vector* this, Vector_procedure f) {
...
@@ -260,3 +266,5 @@ void Vector_foreach(Vector* this, Vector_procedure f) {
f(this->array[i]);
f(this->array[i]);
assert(Vector_isConsistent(this));
assert(Vector_isConsistent(this));
}
}
*/
Vector.h
View file @
da23c8c5
...
@@ -65,12 +65,16 @@ extern Object* Vector_get(Vector* this, int index);
...
@@ -65,12 +65,16 @@ extern Object* Vector_get(Vector* this, int index);
extern
int
Vector_size
(
Vector
*
this
);
extern
int
Vector_size
(
Vector
*
this
);
void
Vector_merge
(
Vector
*
this
,
Vector
*
v2
);
/*
*/
void
Vector_add
(
Vector
*
this
,
void
*
data_
);
void
Vector_add
(
Vector
*
this
,
void
*
data_
);
extern
int
Vector_indexOf
(
Vector
*
this
,
void
*
search_
,
Object_Compare
compare
);
extern
int
Vector_indexOf
(
Vector
*
this
,
void
*
search_
,
Object_Compare
compare
);
void
Vector_foreach
(
Vector
*
this
,
Vector_procedure
f
);
/*
*/
#endif
#endif
htop.c
View file @
da23c8c5
...
@@ -35,14 +35,14 @@ in the source distribution for its full text.
...
@@ -35,14 +35,14 @@ in the source distribution for its full text.
#define INCSEARCH_MAX 40
#define INCSEARCH_MAX 40
void
printVersionFlag
()
{
static
void
printVersionFlag
()
{
clear
();
clear
();
printf
(
"htop "
VERSION
" - (C) 2004-2008 Hisham Muhammad.
\n
"
);
printf
(
"htop "
VERSION
" - (C) 2004-2008 Hisham Muhammad.
\n
"
);
printf
(
"Released under the GNU GPL.
\n\n
"
);
printf
(
"Released under the GNU GPL.
\n\n
"
);
exit
(
0
);
exit
(
0
);
}
}
void
printHelpFlag
()
{
static
void
printHelpFlag
()
{
clear
();
clear
();
printf
(
"htop "
VERSION
" - (C) 2004-2008 Hisham Muhammad.
\n
"
);
printf
(
"htop "
VERSION
" - (C) 2004-2008 Hisham Muhammad.
\n
"
);
printf
(
"Released under the GNU GPL.
\n\n
"
);
printf
(
"Released under the GNU GPL.
\n\n
"
);
...
@@ -54,7 +54,7 @@ void printHelpFlag() {
...
@@ -54,7 +54,7 @@ void printHelpFlag() {
exit
(
0
);
exit
(
0
);
}
}
void
showHelp
(
ProcessList
*
pl
)
{
static
void
showHelp
(
ProcessList
*
pl
)
{
clear
();
clear
();
attrset
(
CRT_colors
[
HELP_BOLD
]);
attrset
(
CRT_colors
[
HELP_BOLD
]);
...
@@ -201,13 +201,13 @@ static Object* pickFromList(Panel* panel, Panel* list, int x, int y, char** keyL
...
@@ -201,13 +201,13 @@ static Object* pickFromList(Panel* panel, Panel* list, int x, int y, char** keyL
return
NULL
;
return
NULL
;
}
}
void
addUserToList
(
int
key
,
void
*
userCast
,
void
*
panelCast
)
{
static
void
addUserToList
(
int
key
,
void
*
userCast
,
void
*
panelCast
)
{
char
*
user
=
(
char
*
)
userCast
;
char
*
user
=
(
char
*
)
userCast
;
Panel
*
panel
=
(
Panel
*
)
panelCast
;
Panel
*
panel
=
(
Panel
*
)
panelCast
;
Panel_add
(
panel
,
(
Object
*
)
ListItem_new
(
user
,
key
));
Panel_add
(
panel
,
(
Object
*
)
ListItem_new
(
user
,
key
));
}
}
void
setUserOnly
(
const
char
*
userName
,
bool
*
userOnly
,
uid_t
*
userId
)
{
static
void
setUserOnly
(
const
char
*
userName
,
bool
*
userOnly
,
uid_t
*
userId
)
{
struct
passwd
*
user
=
getpwnam
(
userName
);
struct
passwd
*
user
=
getpwnam
(
userName
);
if
(
user
)
{
if
(
user
)
{
*
userOnly
=
true
;
*
userOnly
=
true
;
...
...
htop.h
View file @
da23c8c5
...
@@ -39,16 +39,6 @@ in the source distribution for its full text.
...
@@ -39,16 +39,6 @@ in the source distribution for its full text.
#define INCSEARCH_MAX 40
#define INCSEARCH_MAX 40
void
printVersionFlag
();
void
printHelpFlag
();
void
showHelp
(
ProcessList
*
pl
);
void
addUserToList
(
int
key
,
void
*
userCast
,
void
*
panelCast
);
void
setUserOnly
(
const
char
*
userName
,
bool
*
userOnly
,
uid_t
*
userId
);
int
main
(
int
argc
,
char
**
argv
);
int
main
(
int
argc
,
char
**
argv
);
#endif
#endif
Prev
1
2
3
4
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment