I'm not talking about used/unused here. I have two stylesheets and some rules differ (either in selectors, rules or both) and some are exactly the same.

So I'm looking for a way to extract and move those rules, which are the same in both files, into a third stylesheet.

In other words: an intersection of two stylesheets. Strangely, I couldn't find a software for this. Would have expected this to be a more common problem.

Background, for those who care: I'm converting a desktop website into a mobile one and I've started by duplicating the desktop stylesheet and changing it (throwing stuff out, adding to it).


Question: Euclid's Algorithm (Greatest Common Divisor)
Answer: Unlike Yuushi, I'm not too fond of recursions, at least when they are not really needed. This is one of those cases.

First, the negative input... The greatest common divisor of numbers -8 and -12 is 4, wouldn't you agree? So, instead of

else if((m &lt; 0) || (n &lt; 0))
    return -1;


I'd put

if (m &lt; 0) m = -m;
if (n &lt; 0) n = -n;


to ensure that both of the numbers are nonnegative. Btw, else rarely (if ever) makes sense after return.

Second, I think that breaking the loop

if (r == 0)
    break;


is misguiding, because what you really want to do is stop the function and return the result. In other words,

if (r == 0) return n;


Third, since your loop is technically infinite, then do { ... } while(true); is equivalent to while (1) { ... }. Personally, I find the latter to be more readable.

Lastly, true does not exist in standard C. If you really want to use it, then include stdbool.h. This belongs to the C99 standard (so, it doesn't work in C89/C90). Personally, I prefer 1 and 0, but this is probably a matter of habit.