Hurricos / realtek-poe

5 stars 10 forks source link

Eliminate global variables and clean up coding style #36

Closed mrnuke closed 1 week ago

mrnuke commented 3 months ago

The original realtek-poe contained a tonne of global variables. I never liked that approach, but it also didn't really get in the way. Thus there was no immediate need to invest a large effort to refactor the passing of arguments.

However, this really started to bite us in the ass when looking at adding another dialect in #25 . It makes splitting code into different files difficult, and causes a bunch of maintainability issues that I don't list here.

So let's improve the situation, and use proper contexts throughout realtek-poe.

Hurricos commented 1 week ago

ea32075ae41874043eeed14156755a4c0f114582 created a conflict. It's dumb and it's simple.

diff --cc src/main.c                                                                   
index 7a1fa7a,eed5c6c..0000000                                                         
--- a/src/main.c                                                                       
+++ b/src/main.c                                                                                                                                                              
@@@ -25,34 -24,7 +24,11 @@@ typedef int (*poe_reply_handler)(unsign                                                                                                           

  /* Careful with this; Only works for set_detection/disconnect_type commands. */                                                                                             
  #define PORT_ID_ALL   0x7f                                                                                                                                                  
++<<<<<<< HEAD                                                                                                                                                                
 +#define MAX_PORT      48                                                             
++=======                                                                              
++>>>>>>> 9f5b7c0 (realtek-poe: move protocol-agnostic code to common header)         

I hate merge commits. They make me sad. So, I rebased mrnuke-tek-poe-cleanups onto realtek-poe, then force-pushed.

Hurricos commented 1 week ago

Merged into realtek-poe.