Skip to content

Instantly share code, notes, and snippets.

@rundel
Created November 13, 2017 01:35
Show Gist options
  • Save rundel/e64e184f0d2fcceaf14ef011b3432a07 to your computer and use it in GitHub Desktop.
Save rundel/e64e184f0d2fcceaf14ef011b3432a07 to your computer and use it in GitHub Desktop.
Patch for libspatialite to support lwgeom >= 2.2
diff --git a/src/gaiageo/gg_lwgeom.c b/src/gaiageo/gg_lwgeom.c
index 0ae8e71..328a5bc 100644
--- a/src/gaiageo/gg_lwgeom.c
+++ b/src/gaiageo/gg_lwgeom.c
@@ -90,29 +90,29 @@ splite_lwgeom_version (void)
static void
lwgaia_noticereporter (const char *fmt, va_list ap)
{
- char *msg;
- if (!lw_vasprintf (&msg, fmt, ap))
+ char *msg = sqlite3_vmprintf (fmt, ap);
+ if (msg == NULL)
{
- va_end (ap);
- return;
+ va_end (ap);
+ return;
}
spatialite_e ("LWGEOM notice: %s\n", msg);
gaiaSetLwGeomWarningMsg (msg);
- free (msg);
+ sqlite3_free (msg);
}
static void
lwgaia_errorreporter (const char *fmt, va_list ap)
{
- char *msg;
- if (!lw_vasprintf (&msg, fmt, ap))
+ char *msg = sqlite3_vmprintf (fmt, ap);
+ if (msg == NULL)
{
- va_end (ap);
- return;
+ va_end (ap);
+ return;
}
spatialite_e ("LWGEOM error: %s\n", msg);
gaiaSetLwGeomErrorMsg (msg);
- free (msg);
+ sqlite3_free (msg);
}
#ifndef POSTGIS_2_1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment