Drop redundant casts to the same type

This commit is contained in:
Christian Göttsche 2020-09-28 12:17:52 +02:00 committed by cgzones
parent 214c742ae1
commit 843949131a
9 changed files with 12 additions and 12 deletions

View File

@ -305,7 +305,7 @@ static Htop_Reaction actionSetAffinity(State* st) {
} }
static Htop_Reaction actionKill(State* st) { static Htop_Reaction actionKill(State* st) {
Panel* signalsPanel = (Panel*) SignalsPanel_new(); Panel* signalsPanel = SignalsPanel_new();
ListItem* sgn = (ListItem*) Action_pickFromVector(st, signalsPanel, 15, true); ListItem* sgn = (ListItem*) Action_pickFromVector(st, signalsPanel, 15, true);
if (sgn) { if (sgn) {
if (sgn->key != 0) { if (sgn->key != 0) {

View File

@ -25,7 +25,7 @@ static void AvailableMetersPanel_delete(Object* object) {
} }
static inline void AvailableMetersPanel_addMeter(Header* header, Panel* panel, MeterClass* type, int param, int column) { static inline void AvailableMetersPanel_addMeter(Header* header, Panel* panel, MeterClass* type, int param, int column) {
Meter* meter = (Meter*) Header_addMeterByClass(header, type, param, column); Meter* meter = Header_addMeterByClass(header, type, param, column);
Panel_add(panel, (Object*) Meter_toListItem(meter, false)); Panel_add(panel, (Object*) Meter_toListItem(meter, false));
Panel_setSelected(panel, Panel_size(panel) - 1); Panel_setSelected(panel, Panel_size(panel) - 1);
MetersPanel_setMoving((MetersPanel*)panel, true); MetersPanel_setMoving((MetersPanel*)panel, true);

View File

@ -57,7 +57,7 @@ void InfoScreen_addLine(InfoScreen* this, const char* line) {
Vector_add(this->lines, (Object*) ListItem_new(line, 0)); Vector_add(this->lines, (Object*) ListItem_new(line, 0));
const char* incFilter = IncSet_filter(this->inc); const char* incFilter = IncSet_filter(this->inc);
if (!incFilter || String_contains_i(line, incFilter)) if (!incFilter || String_contains_i(line, incFilter))
Panel_add(this->display, (Object*)Vector_get(this->lines, Vector_size(this->lines)-1)); Panel_add(this->display, Vector_get(this->lines, Vector_size(this->lines)-1));
} }
void InfoScreen_appendLine(InfoScreen* this, const char* line) { void InfoScreen_appendLine(InfoScreen* this, const char* line) {

View File

@ -282,7 +282,7 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) {
struct timeval now; struct timeval now;
gettimeofday(&now, NULL); gettimeofday(&now, NULL);
if (!timercmp(&now, &(data->time), <)) { if (!timercmp(&now, &(data->time), <)) {
struct timeval delay = { .tv_sec = (int)(CRT_delay/10), .tv_usec = (CRT_delay-((int)(CRT_delay/10)*10)) * 100000 }; struct timeval delay = { .tv_sec = CRT_delay/10, .tv_usec = (CRT_delay-((CRT_delay/10)*10)) * 100000 };
timeradd(&now, &delay, &(data->time)); timeradd(&now, &delay, &(data->time));
for (int i = 0; i < nValues - 1; i++) for (int i = 0; i < nValues - 1; i++)

View File

@ -112,7 +112,7 @@ char* String_getToken(const char* line, const unsigned short int numMatch) {
} }
match[foundCount] = '\0'; match[foundCount] = '\0';
return((char*)xStrdup(match)); return xStrdup(match);
} }
char* String_readLine(FILE* fd) { char* String_readLine(FILE* fd) {

View File

@ -309,7 +309,7 @@ inline int Vector_indexOf(Vector* this, void* search_, Object_Compare compare) {
assert(compare); assert(compare);
assert(Vector_isConsistent(this)); assert(Vector_isConsistent(this));
for (int i = 0; i < this->items; i++) { for (int i = 0; i < this->items; i++) {
Object* o = (Object*)this->array[i]; Object* o = this->array[i];
assert(o); assert(o);
if (compare(search, o) == 0) if (compare(search, o) == 0)
return i; return i;

View File

@ -100,11 +100,11 @@ static ACPresence procAcpiCheck(void) {
} }
for (;;) { for (;;) {
struct dirent* dirEntry = readdir((DIR *) dir); struct dirent* dirEntry = readdir(dir);
if (!dirEntry) if (!dirEntry)
break; break;
char* entryName = (char *) dirEntry->d_name; const char* entryName = dirEntry->d_name;
if (entryName[0] != 'A') if (entryName[0] != 'A')
continue; continue;
@ -189,10 +189,10 @@ static void Battery_getSysData(double* level, ACPresence* isOnAC) {
unsigned long int totalRemain = 0; unsigned long int totalRemain = 0;
for (;;) { for (;;) {
struct dirent* dirEntry = readdir((DIR *) dir); struct dirent* dirEntry = readdir(dir);
if (!dirEntry) if (!dirEntry)
break; break;
char* entryName = (char *) dirEntry->d_name; const char* entryName = dirEntry->d_name;
char filePath[256]; char filePath[256];
xSnprintf(filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/type", entryName); xSnprintf(filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/type", entryName);

View File

@ -290,7 +290,7 @@ void LinuxProcess_writeField(Process* this, RichString* str, ProcessField field)
xSnprintf(buffer, n, "%5lu ", lp->ctxt_diff); xSnprintf(buffer, n, "%5lu ", lp->ctxt_diff);
break; break;
default: default:
Process_writeField((Process*)this, str, field); Process_writeField(this, str, field);
return; return;
} }
RichString_append(str, attr, buffer); RichString_append(str, attr, buffer);

View File

@ -232,7 +232,7 @@ static inline unsigned long long LinuxProcess_adjustTime(unsigned long long t) {
jiffy = sc_jiffy; jiffy = sc_jiffy;
} }
double jiffytime = 1.0 / jiffy; double jiffytime = 1.0 / jiffy;
return (unsigned long long) t * jiffytime * 100; return t * jiffytime * 100;
} }
static bool LinuxProcessList_readStatFile(Process *process, const char* dirname, const char* name, char* command, int* commLen) { static bool LinuxProcessList_readStatFile(Process *process, const char* dirname, const char* name, char* command, int* commLen) {