mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-25 12:10:03 +00:00
Remove code smells
This commit is contained in:
parent
4a1cf45795
commit
2a24fe36db
@ -836,7 +836,7 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
||||
obj->callbacks.print = &print_password;
|
||||
obj->callbacks.free = &gen_free_opaque;
|
||||
|
||||
#ifdef __x86_64__
|
||||
#ifdef __x86_64__
|
||||
END OBJ(freq2, 0)
|
||||
obj->callbacks.print = &print_freq2;
|
||||
#endif /* __x86_64__ */
|
||||
|
23
src/cpu.cc
23
src/cpu.cc
@ -65,8 +65,12 @@
|
||||
#endif /* __FreeBSD__ */
|
||||
|
||||
uint8_t has_tsc_reg(void) {
|
||||
uint_fast16_t vend = 0, leafs = 0;
|
||||
uint_fast16_t eax = 0, ecx = 0, edx = 0, ebx = 0;
|
||||
uint_fast16_t vend = 0;
|
||||
uint_fast16_t leafs = 0;
|
||||
uint_fast16_t eax = 0;
|
||||
uint_fast16_t ecx = 0;
|
||||
uint_fast16_t edx = 0;
|
||||
uint_fast16_t ebx = 0;
|
||||
|
||||
CPU_REGS(0x00000000, vend, leafs);
|
||||
if (0x00000001 > leafs) {
|
||||
@ -84,9 +88,14 @@ uint8_t has_tsc_reg(void) {
|
||||
}
|
||||
|
||||
uintmax_t rdtsc(void) {
|
||||
unsigned int tickhi = 0, ticklo = 0;
|
||||
uint_fast16_t eax = 0, ecx = 0, edx = 0, ebx = 0;
|
||||
uint_fast16_t regz = 0, x = 0;
|
||||
unsigned int tickhi = 0;
|
||||
unsigned int ticklo = 0;
|
||||
uint_fast16_t eax = 0;
|
||||
uint_fast16_t ecx = 0;
|
||||
uint_fast16_t edx = 0;
|
||||
uint_fast16_t ebx = 0;
|
||||
uint_fast16_t regz = 0;
|
||||
uint_fast16_t x = 0;
|
||||
|
||||
if (0U != (has_tsc_reg())) {
|
||||
goto seeya;
|
||||
@ -123,7 +132,8 @@ seeya:
|
||||
|
||||
void
|
||||
get_cpu_clock_speed(char *str1, int p_max_size) {
|
||||
uintmax_t x = 0, z = 0;
|
||||
uintmax_t x = 0;
|
||||
uintmax_t z = 0;
|
||||
struct timespec tc = {0L, 0L};
|
||||
|
||||
tc.tv_nsec = TICKZ * 1000000L;
|
||||
@ -140,7 +150,6 @@ get_cpu_clock_speed(char *str1, int p_max_size) {
|
||||
void print_freq2(struct text_object *obj, char *p, int p_max_size) {
|
||||
(void)obj;
|
||||
get_cpu_clock_speed(p, p_max_size);
|
||||
return;
|
||||
}
|
||||
|
||||
#else
|
||||
|
@ -90,7 +90,8 @@ void print_password(struct text_object *obj, char *p, int p_max_size) {
|
||||
time_t t;
|
||||
static const char letters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789~!@#$%^&*()_";
|
||||
static const int len = (int)sizeof(letters) - 1;
|
||||
uintmax_t x = strtoumax(obj->data.s, (char **)NULL, 10), z = 0;
|
||||
uintmax_t x = strtoumax(obj->data.s, (char **)NULL, 10);
|
||||
uintmax_t z = 0;
|
||||
|
||||
if (-1 == (t = time(NULL))) {
|
||||
return;
|
||||
|
@ -1308,7 +1308,6 @@ void print_##func(struct text_object *obj, char *p, int p_max_size) { \
|
||||
XKeyboardState x; \
|
||||
XGetKeyboardControl(display, &x); \
|
||||
snprintf(p, p_max_size, "%s", (x.led_mask & num ? "On" : "Off")); \
|
||||
return; \
|
||||
}
|
||||
|
||||
LOCK_TEMPLATE(num_led, 2)
|
||||
@ -1328,7 +1327,6 @@ void print_kb_layout(struct text_object *obj, char *p, int p_max_size) {
|
||||
|
||||
snprintf(p, p_max_size, "%s", (group != NULL ? group : "unknown"));
|
||||
XFree(group);
|
||||
return;
|
||||
}
|
||||
|
||||
void print_mouse_speed(struct text_object *obj, char *p, int p_max_size) {
|
||||
@ -1337,5 +1335,4 @@ void print_mouse_speed(struct text_object *obj, char *p, int p_max_size) {
|
||||
|
||||
XGetPointerControl(display, &acc_num, &acc_denom, &threshold);
|
||||
snprintf(p, p_max_size, "%d%%", (110 - threshold));
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user