Back to index

lightning-sunbird  0.9+nobinonly
Functions
nsVersionComparator.h File Reference
#include "nscore.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

PRInt32 NS_COM_GLUE NS_CompareVersions (const char *A, const char *B)
 Compare two version strings.

Function Documentation

PRInt32 NS_COM_GLUE NS_CompareVersions ( const char *  A,
const char *  B 
)

Compare two version strings.

See also:
nsIVersionComparator

Definition at line 193 of file nsVersionComparator.cpp.

{
  char *A2 = strdup(A);
  if (!A2)
    return 1;

  char *B2 = strdup(B);
  if (!B2) {
    free(A2);
    return 1;
  }

  PRInt32 result;
  char *a = A2, *b = B2;

  do {
    VersionPart va, vb;

    a = ParseVP(a, va);
    b = ParseVP(b, vb);

    result = CompareVP(va, vb);
    if (result)
      break;

  } while (a || b);

  free(A2);
  free(B2);

  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function: