Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Cleanup and initial OpenBSD support #274

Merged
merged 6 commits into from
Oct 5, 2015
Merged

Cleanup and initial OpenBSD support #274

merged 6 commits into from
Oct 5, 2015

Conversation

mmcco
Copy link
Contributor

@mmcco mmcco commented Sep 17, 2015

The person writing the Darwin code has a pretty strange style, honestly. Not putting spaces after condition keywords, putting 0 or NULL first in comparisons, etc.

exit(9);
}
if (host_statistics64(mach_host_self(), HOST_VM_INFO64, (host_info_t)p, &info_size) != 0)
err(9, "Unable to retrieve VM statistics\n");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid removing braces, even when block contains a single statement

@hishamhm
Copy link
Owner

Thanks for taking a closer look at the Darwin codebase. Is this good to merge?

@@ -55,13 +55,13 @@ inline int String_eq(const char* s1, const char* s2) {
char** String_split(const char* s, char sep, int* n) {
*n = 0;
const int rate = 10;
char** out = (char**) malloc(sizeof(char*) * rate);
char** out = calloc(rate, sizeof(char**));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one looks wrong. We need sizeof(char_), not sizeof(char_*).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is indeed wrong, I was moving too fast. We need sizeof(char*).

@mmcco
Copy link
Contributor Author

mmcco commented Sep 17, 2015

There are too many small mistakes in here to merge. It was a hasty correction of a few issues I came across while porting to OpenBSD. You can consider it a guideline and add them manually, or I can submit a more carefully written patch soon.

@mmcco
Copy link
Contributor Author

mmcco commented Sep 18, 2015

I just added my OpenBSD port. I also fixed the calloc() mistake I made. I still need to change some of the err()s to errx()s, but that's minor. A file or two in Darwin may be missing #include <err.h>, too. I need to sleep first, though.

@hishamhm
Copy link
Owner

Please make separate PRs, especially for a large feature such as OpenBSD support.
Also, make sure that indentation is consistent with the rest of htop's codebase.
Adding OpenBSD support is a great feature! Thank you :)

And do get some sleep! Health is important :)

@mmcco mmcco changed the title Clean up some needless malloc casts, convert some mallocs to callocs, and fix some style Cleanup and OpenBSD support Sep 19, 2015
@mmcco mmcco changed the title Cleanup and OpenBSD support Minor cleanup Sep 19, 2015
@mmcco mmcco changed the title Minor cleanup Cleanup and initial OpenBSD support Sep 19, 2015
hishamhm added a commit that referenced this pull request Oct 5, 2015
Cleanup and initial OpenBSD support
@hishamhm hishamhm merged commit bf276a0 into hishamhm:master Oct 5, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants