Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing #include in util.cpp #1144

Closed
anderstn opened this issue Apr 29, 2015 · 2 comments · Fixed by #1151
Closed

Missing #include in util.cpp #1144

anderstn opened this issue Apr 29, 2015 · 2 comments · Fixed by #1151
Assignees
Milestone

Comments

@anderstn
Copy link

In commit 7e1b94b a macro using stderr was added in util.cpp however stdio.h was not included. As a result the file won't compile on Windows.

Broken code:

#include<stdint.h>
#include "ast.hpp"
#include "util.hpp"
#include "prelexer.hpp"
#include "utf8/checked.h"

namespace Sass {

  #define out_of_memory() do {                    \
      fprintf(stderr, "Out of memory.\n");    \
      exit(EXIT_FAILURE);                     \
    } while (0)

  /* Sadly, sass_strdup is not portable. */
  char *sass_strdup(const char *str)
  {
    char *ret = (char*) malloc(strlen(str) + 1);
    if (ret == NULL)
      out_of_memory();
    strcpy(ret, str);
    return ret;
  }

  ...
}

Code that compiles:

#include<stdint.h>
#include<stdio.h>
#include "ast.hpp"
#include "util.hpp"
#include "prelexer.hpp"
#include "utf8/checked.h"

namespace Sass {

  #define out_of_memory() do {                    \
      fprintf(stderr, "Out of memory.\n");    \
      exit(EXIT_FAILURE);                     \
    } while (0)

  /* Sadly, sass_strdup is not portable. */
  char *sass_strdup(const char *str)
  {
    char *ret = (char*) malloc(strlen(str) + 1);
    if (ret == NULL)
      out_of_memory();
    strcpy(ret, str);
    return ret;
  }

  ...
}
@xzyfer
Copy link
Contributor

xzyfer commented Apr 29, 2015

This was also reported in sass/node-sass#892 prevent compilations on FreeBSD

@mgreter mgreter added this to the 3.2.1 milestone Apr 29, 2015
This was referenced Apr 29, 2015
@xzyfer xzyfer modified the milestones: hotfix, 3.2.1 Apr 30, 2015
@xzyfer xzyfer self-assigned this Apr 30, 2015
@xzyfer
Copy link
Contributor

xzyfer commented Apr 30, 2015

Fixed in 3.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants