Core Base Classes for the Light Endpoints

Dependencies:   BufferedSerial

Dependents:   mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet ... more

Revision:
26:791d22d43cb4
Parent:
20:f2dbbd852e08
Child:
68:e6431dfe2f30
--- a/main.cpp	Thu Feb 27 04:05:31 2014 +0000
+++ b/main.cpp	Thu Feb 27 06:04:52 2014 +0000
@@ -36,14 +36,6 @@
  ErrorHandler *error_handler = NULL;
  MBEDEndpoint *endpoint = NULL;
  
- // cannot seem to find strdup() anywhere..
- char* strdup (const char *str) {
-    char *result = (char*)(malloc (strlen (str) + 1));
-    if (result != NULL)
-        strcpy (result,str);
-    return result;
- }
-
  // ErrorHandler (logger)
  ErrorHandler *logger() { return error_handler; }    
  
@@ -62,12 +54,11 @@
          error_handler->log("Closing down Endpoint...");
          delete endpoint;
      }
-    
+     if (error_handler != NULL) delete error_handler;
      pc.printf("Exiting...\r\n");
      lcd.cls();
      lcd.locate(0,0);
      lcd.printf("Endpoint Shutdown %s",strCode(code));
-     delete error_handler;
      exit(1);
  }