dernier leaks disparu avec nouvelle fonction dans read_file

This commit is contained in:
Hugo LAMY
2019-06-01 15:13:08 +02:00
parent f29d9d8e60
commit 5bdc944da9
5 changed files with 40 additions and 9 deletions

View File

@@ -6,7 +6,7 @@
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/05/27 13:46:29 by hulamy #+# #+# */
/* Updated: 2019/06/01 14:17:43 by hulamy ### ########.fr */
/* Updated: 2019/06/01 15:00:01 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */

View File

@@ -6,7 +6,7 @@
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/13 12:09:46 by vmanzoni #+# #+# */
/* Updated: 2019/05/29 16:10:58 by hulamy ### ########.fr */
/* Updated: 2019/06/01 15:12:03 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
@@ -36,3 +36,15 @@ char *read_file(char *file)
close(fd);
return (result);
}
/*
** Function that init num and size for search_map
*/
void init_num_and_size(int num, int *size, t_fillist *tmp)
{
while ((tmp = tmp->next))
num++;
while (*size * *size < num * 4)
(*size)++;
}

View File

@@ -6,7 +6,7 @@
/* By: hulamy <hulamy@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/27 20:47:22 by hulamy #+# #+# */
/* Updated: 2019/06/01 14:19:22 by hulamy ### ########.fr */
/* Updated: 2019/06/01 15:12:08 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
@@ -148,12 +148,8 @@ int search_map(t_fillist *list)
int i;
size = 2;
num = 1;
tmp = print_tetri(list);
while ((tmp = tmp->next))
num++;
while (size * size < num * 4)
size++;
init_num_and_size(1, &size, tmp);
i = 0;
while (!i)
{
@@ -164,6 +160,8 @@ int search_map(t_fillist *list)
while (num--)
map[num] = 0;
i = fill_map(map, list, size++);
if (!i)
free(map);
}
return (print_binary_map(map, size, list->dope));
}

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.fillit</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@@ -6,7 +6,7 @@
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/01 13:34:46 by vmanzoni #+# #+# */
/* Updated: 2019/06/01 14:34:31 by hulamy ### ########.fr */
/* Updated: 2019/06/01 15:12:00 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
@@ -97,6 +97,7 @@ int main(int argc, char **argv);
** read_file.c
*/
char *read_file(char *file);
void init_num_and_size(int num, int *size, t_fillist *tmp);
/*
** handle_errors.c