ss7m / paleofetch

neofetch, but written in C
MIT License
167 stars 50 forks source link

Make substring removing for CPU and GPU configurable #39

Closed dwzg closed 4 years ago

dwzg commented 4 years ago

This adds a configurable way to remove substrings from CPU and GPU model names. I was not able to make it work with the new REPLACE_CONST_STRING macro. It would be nice if one could omit the substring length in the config, maybe somebody has a neat idea for this.

ss7m commented 4 years ago

This is a really good idea. I think I'd prefer it to where you don't have to work out the length of the string when configuring. It's a small detail but will be a large increase in usability.

dwzg commented 4 years ago

Yes, I also want to have it without the necessity to set the string length. That's why I kept this as a draft. I will continue working on it, but maybe somebody else has a nice solution for this.

ss7m commented 4 years ago

This is the best I could come up with if we still have length as a parameter to remove_substring.

I suppose we could forgo the length parameter and just add a call to strlen somewhere in there. And since CPU and GPU get cached, the (very, very small) performance difference won't really matter.

dwzg commented 4 years ago

I like your approach to this. I'm working on a function to replace substrings, which could fit nicely into the same config using a second macro. I have a use case for this, as one of my processors is called "Core2" which I want to replace with "Core 2".