Commit 670cc898 by Adeel

Code: Cleanup and formatting.

parent 1d597d5f
#include<iostream>
#include <nan.h> #include <nan.h>
#include "sass_context_wrapper.h" #include "sass_context_wrapper.h"
......
...@@ -8,7 +8,8 @@ extern "C" { ...@@ -8,7 +8,8 @@ extern "C" {
if (ctx_w->dctx) { if (ctx_w->dctx) {
compile_data(ctx_w->dctx); compile_data(ctx_w->dctx);
} else if (ctx_w->fctx) { }
else if (ctx_w->fctx) {
compile_file(ctx_w->fctx); compile_file(ctx_w->fctx);
} }
} }
...@@ -23,7 +24,7 @@ extern "C" { ...@@ -23,7 +24,7 @@ extern "C" {
sass_context_wrapper* sass_make_context_wrapper() { sass_context_wrapper* sass_make_context_wrapper() {
// (sass_context_wrapper*) calloc(1, sizeof(sass_context_wrapper)); // (sass_context_wrapper*) calloc(1, sizeof(sass_context_wrapper));
auto ctx_w = (sass_context_wrapper*) calloc(1, sizeof(sass_context_wrapper)); auto ctx_w = (sass_context_wrapper*)calloc(1, sizeof(sass_context_wrapper));
ctx_w->importer_mutex = new std::mutex(); ctx_w->importer_mutex = new std::mutex();
return ctx_w; return ctx_w;
} }
...@@ -31,7 +32,8 @@ extern "C" { ...@@ -31,7 +32,8 @@ extern "C" {
void sass_free_context_wrapper(sass_context_wrapper* ctx_w) { void sass_free_context_wrapper(sass_context_wrapper* ctx_w) {
if (ctx_w->dctx) { if (ctx_w->dctx) {
sass_delete_data_context(ctx_w->dctx); sass_delete_data_context(ctx_w->dctx);
} else if (ctx_w->fctx) { }
else if (ctx_w->fctx) {
sass_delete_file_context(ctx_w->fctx); sass_delete_file_context(ctx_w->fctx);
} }
......
...@@ -6,30 +6,30 @@ ...@@ -6,30 +6,30 @@
extern "C" { extern "C" {
#endif #endif
using namespace v8; using namespace v8;
void compile_data(struct Sass_Data_Context* dctx); void compile_data(struct Sass_Data_Context* dctx);
void compile_file(struct Sass_File_Context* fctx); void compile_file(struct Sass_File_Context* fctx);
void compile_it(uv_work_t* req); void compile_it(uv_work_t* req);
struct sass_context_wrapper { struct sass_context_wrapper {
Sass_Data_Context* dctx; Sass_Data_Context* dctx;
Sass_File_Context* fctx; Sass_File_Context* fctx;
Persistent<Object> stats; Persistent<Object> stats;
uv_work_t request; uv_work_t request;
std::mutex* importer_mutex; std::mutex* importer_mutex;
//uv_mutex_t* mutex; //uv_mutex_t* mutex;
uv_async_t async; uv_async_t async;
const char* file; const char* file;
void* cookie; void* cookie;
Sass_Import** imports; Sass_Import** imports;
NanCallback* success_callback; NanCallback* success_callback;
NanCallback* error_callback; NanCallback* error_callback;
NanCallback* importer_callback; NanCallback* importer_callback;
}; };
struct sass_context_wrapper* sass_make_context_wrapper(void); struct sass_context_wrapper* sass_make_context_wrapper(void);
void sass_free_context_wrapper(struct sass_context_wrapper* ctx_w); void sass_free_context_wrapper(struct sass_context_wrapper* ctx_w);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment