Skip to content

Commit

Permalink
Merge pull request #179 from cs50/develop
Browse files Browse the repository at this point in the history
9.0.2
  • Loading branch information
dmalan authored Aug 18, 2019
2 parents 3d83ff0 + b7af39e commit e591d85
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION := 9.0.1
VERSION := 9.0.2
MAJOR_VERSION := $(shell echo $(VERSION) | head -c 1)

# installation directory (/usr/local by default)
Expand Down Expand Up @@ -34,7 +34,7 @@ all: $(LIBS) $(MANS)

$(LIBS): $(SRC) $(INCLUDE) Makefile
$(CC) $(CFLAGS) -fPIC -shared $(LINKER_FLAGS) -o $(LIB_VERSION) $(SRC)
ln -sf $(LIB_MAJOR) $(LIB_BASE)
ln -sf $(LIB_VERSION) $(LIB_BASE)
mkdir -p $(addprefix build/, include lib src)
install -m 644 $(SRC) build/src
install -m 644 $(INCLUDE) build/include
Expand All @@ -43,8 +43,8 @@ $(LIBS): $(SRC) $(INCLUDE) Makefile
.PHONY: install
install: all
mkdir -p $(addprefix $(DESTDIR)/, src lib include $(MANDIR))
cp -r $(filter-out deb, $(wildcard build/*)) $(DESTDIR)
cp -r $(MANS) $(DESTDIR)/$(MANDIR)
cp -R $(filter-out deb, $(wildcard build/*)) $(DESTDIR)
cp -R $(MANS) $(DESTDIR)/$(MANDIR)

ifeq ($(OS),Linux)
ldconfig $(DESTDIR)/lib
Expand Down
12 changes: 6 additions & 6 deletions src/cs50.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static string *strings = NULL;
* on heap, but library's destructor frees memory on program's exit.
*/
#undef get_string
string get_string(va_list *args, const string format, ...)
string get_string(va_list *args, const char *format, ...)
{
// Check whether we have room for another string
if (allocations == SIZE_MAX / sizeof (string))
Expand Down Expand Up @@ -214,7 +214,7 @@ string get_string(va_list *args, const string format, ...)
* equivalent char; if text is not a single char, user is prompted
* to retry. If line can't be read, returns CHAR_MAX.
*/
char get_char(const string format, ...)
char get_char(const char *format, ...)
{
va_list ap;
va_start(ap, format);
Expand Down Expand Up @@ -246,7 +246,7 @@ char get_char(const string format, ...)
* a double or if value would cause underflow or overflow, user is
* prompted to retry. If line can't be read, returns DBL_MAX.
*/
double get_double(const string format, ...)
double get_double(const char *format, ...)
{
va_list ap;
va_start(ap, format);
Expand Down Expand Up @@ -287,7 +287,7 @@ double get_double(const string format, ...)
* a float or if value would cause underflow or overflow, user is prompted
* to retry. If line can't be read, returns FLT_MAX.
*/
float get_float(const string format, ...)
float get_float(const char *format, ...)
{
va_list ap;
va_start(ap, format);
Expand Down Expand Up @@ -329,7 +329,7 @@ float get_float(const string format, ...)
* or would cause underflow or overflow, user is prompted to retry. If line
* can't be read, returns INT_MAX.
*/
int get_int(const string format, ...)
int get_int(const char *format, ...)
{
va_list ap;
va_start(ap, format);
Expand Down Expand Up @@ -366,7 +366,7 @@ int get_int(const string format, ...)
* [-2^63, 2^63 - 1) or would cause underflow or overflow, user is
* prompted to retry. If line can't be read, returns LONG_MAX.
*/
long get_long(const string format, ...)
long get_long(const char *format, ...)
{
va_list ap;
va_start(ap, format);
Expand Down
12 changes: 6 additions & 6 deletions src/cs50.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,39 +60,39 @@ typedef char *string;
* equivalent char; if text is not a single char, user is prompted
* to retry. If line can't be read, returns CHAR_MAX.
*/
char get_char(const string format, ...) __attribute__((format(printf, 1, 2)));
char get_char(const char *format, ...) __attribute__((format(printf, 1, 2)));

/**
* Prompts user for a line of text from standard input and returns the
* equivalent double as precisely as possible; if text does not represent
* a double or if value would cause underflow or overflow, user is
* prompted to retry. If line can't be read, returns DBL_MAX.
*/
double get_double(const string format, ...) __attribute__((format(printf, 1, 2)));
double get_double(const char *format, ...) __attribute__((format(printf, 1, 2)));

/**
* Prompts user for a line of text from standard input and returns the
* equivalent float as precisely as possible; if text does not represent
* a float or if value would cause underflow or overflow, user is prompted
* to retry. If line can't be read, returns FLT_MAX.
*/
float get_float(const string format, ...) __attribute__((format(printf, 1, 2)));
float get_float(const char *format, ...) __attribute__((format(printf, 1, 2)));

/**
* Prompts user for a line of text from standard input and returns the
* equivalent int; if text does not represent an int in [-2^31, 2^31 - 1)
* or would cause underflow or overflow, user is prompted to retry. If line
* can't be read, returns INT_MAX.
*/
int get_int(const string format, ...) __attribute__((format(printf, 1, 2)));
int get_int(const char *format, ...) __attribute__((format(printf, 1, 2)));

/**
* Prompts user for a line of text from standard input and returns the
* equivalent long; if text does not represent a long in
* [-2^63, 2^63 - 1) or would cause underflow or overflow, user is
* prompted to retry. If line can't be read, returns LONG_MAX.
*/
long get_long(const string format, ...) __attribute__((format(printf, 1, 2)));
long get_long(const char *format, ...) __attribute__((format(printf, 1, 2)));

/**
* Prompts user for a line of text from standard input and returns
Expand All @@ -102,7 +102,7 @@ long get_long(const string format, ...) __attribute__((format(printf, 1, 2)));
* upon error or no input whatsoever (i.e., just EOF). Stores string
* on heap, but library's destructor frees memory on program's exit.
*/
string get_string(va_list *args, const string format, ...) __attribute__((format(printf, 2, 3)));
string get_string(va_list *args, const char *format, ...) __attribute__((format(printf, 2, 3)));
#define get_string(...) get_string(NULL, __VA_ARGS__)

#endif

0 comments on commit e591d85

Please sign in to comment.